diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2006-11-03 11:06:54 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2006-11-03 11:06:54 +0100 |
commit | 5779d9e2ce26a8a9419ebf4fcf02f3571af34332 (patch) | |
tree | c3faeacbfb389bdf198a79de1f2a2a4d6a55ade5 /nss/passwd.c | |
parent | 3a1886177509b8712e447dbfb65293841a832596 (diff) |
make loop macros common, create macros for expanding {set,get,end}ent() functions and implement {set,get,end}aliasent
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@62 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nss/passwd.c')
-rw-r--r-- | nss/passwd.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/nss/passwd.c b/nss/passwd.c index 0557bc6..2ed200f 100644 --- a/nss/passwd.c +++ b/nss/passwd.c @@ -88,45 +88,17 @@ static __thread FILE *pwentfp; /* open a connection to the nslcd and write the request */ enum nss_status _nss_ldap_setpwent(void) { - int32_t tmpint32; - /* this is to satisfy our macros */ - int errnocp; - int *errnop; - errnop=&errnocp; - /* close the existing stream if it is still open */ - if (fp!=NULL) - _nss_ldap_endpwent(); - /* open a new stream and write the request */ - OPEN_SOCK(fp); - WRITE_REQUEST(fp,NSLCD_ACTION_PASSWD_ALL); - WRITE_FLUSH(fp); - /* read response header */ - READ_RESPONSEHEADER(fp,NSLCD_ACTION_PASSWD_ALL); - return NSS_STATUS_SUCCESS; + NSS_SETENT(NSLCD_ACTION_PASSWD_ALL); } /* read password data from an opened stream */ enum nss_status _nss_ldap_getpwent_r(struct passwd *result,char *buffer,size_t buflen,int *errnop) { - int32_t tmpint32; - size_t bufptr=0; - /* check that we have a valid file descriptor */ - if (fp==NULL) - { - *errnop=ENOENT; - return NSS_STATUS_UNAVAIL; - } - /* read a response */ - READ_RESPONSE_CODE(fp); - LDF_PASSWD; - return NSS_STATUS_SUCCESS; + NSS_GETENT(LDF_PASSWD); } /* close the stream opened with setpwent() above */ enum nss_status _nss_ldap_endpwent(void) { - if (fp==NULL) - return NSS_STATUS_SUCCESS; - fclose(fp); - return NSS_STATUS_SUCCESS; + NSS_ENDENT(); } |