From 24fae4c5df0c5152891893ab677edb4a9b497d11 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Mon, 4 Oct 2010 19:37:47 +0000 Subject: improve consistency of code layout git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1240 ef36b2f9-881f-0410-afb5-c4e39611909c --- nss/shadow.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'nss/shadow.c') diff --git a/nss/shadow.c b/nss/shadow.c index 8132e17..2fca8d1 100644 --- a/nss/shadow.c +++ b/nss/shadow.c @@ -2,7 +2,7 @@ shadow.c - NSS lookup functions for shadow database Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008 Arthur de Jong + Copyright (C) 2006, 2007, 2008, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,7 @@ #include "common.h" #include "compat/attrs.h" +/* read a single shadow entry from the stream */ static nss_status_t read_spwd( TFILE *fp,struct spwd *result, char *buffer,size_t buflen,int *errnop) @@ -47,7 +48,10 @@ static nss_status_t read_spwd( return NSS_STATUS_SUCCESS; } -nss_status_t _nss_ldap_getspnam_r(const char *name,struct spwd *result,char *buffer,size_t buflen,int *errnop) +/* get a shadow entry by name */ +nss_status_t _nss_ldap_getspnam_r( + const char *name,struct spwd *result, + char *buffer,size_t buflen,int *errnop) { NSS_BYNAME(NSLCD_ACTION_SHADOW_BYNAME, name, @@ -57,17 +61,22 @@ nss_status_t _nss_ldap_getspnam_r(const char *name,struct spwd *result,char *buf /* thread-local file pointer to an ongoing request */ static __thread TFILE *spentfp; +/* start listing all shadow users */ nss_status_t _nss_ldap_setspent(int UNUSED(stayopen)) { NSS_SETENT(spentfp); } -nss_status_t _nss_ldap_getspent_r(struct spwd *result,char *buffer,size_t buflen,int *errnop) +/* return a single shadow entry read from the stream */ +nss_status_t _nss_ldap_getspent_r( + struct spwd *result, + char *buffer,size_t buflen,int *errnop) { NSS_GETENT(spentfp,NSLCD_ACTION_SHADOW_ALL, read_spwd(spentfp,result,buffer,buflen,errnop)); } +/* close the stream opened by setspent() above */ nss_status_t _nss_ldap_endspent(void) { NSS_ENDENT(spentfp); -- cgit v1.2.3