From 30423d96ecd243663906a3a1c13f1f0e90ac6330 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Fri, 7 Sep 2007 20:51:46 +0000 Subject: make handling of ent_context consistent and simpler git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@382 ef36b2f9-881f-0410-afb5-c4e39611909c --- nslcd/shadow.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'nslcd/shadow.c') diff --git a/nslcd/shadow.c b/nslcd/shadow.c index 6e4d88a..c8493af 100644 --- a/nslcd/shadow.c +++ b/nslcd/shadow.c @@ -227,7 +227,7 @@ int nslcd_shadow_byname(TFILE *fp) int nslcd_shadow_all(TFILE *fp) { int32_t tmpint32; - struct ent_context *shadow_context=NULL; + struct ent_context context; char filter[1024]; /* these are here for now until we rewrite the LDAP code */ struct spwd result; @@ -240,12 +240,11 @@ int nslcd_shadow_all(TFILE *fp) WRITE_INT32(fp,NSLCD_VERSION); WRITE_INT32(fp,NSLCD_ACTION_SHADOW_ALL); /* initialize context */ - if (_nss_ldap_ent_context_init(&shadow_context)==NULL) - return -1; + _nss_ldap_ent_context_init(&context); /* loop over all results */ mkfilter_shadow_all(filter,sizeof(filter)); shadow_attrs_init(); - while ((retv=_nss_ldap_getent(&shadow_context,&result,buffer,sizeof(buffer),&errnop, + while ((retv=_nss_ldap_getent(&context,&result,buffer,sizeof(buffer),&errnop, NULL,filter,shadow_attrs,LM_SHADOW,_nss_ldap_parse_sp))==NSLCD_RESULT_SUCCESS) { /* write the result */ @@ -257,7 +256,7 @@ int nslcd_shadow_all(TFILE *fp) WRITE_FLUSH(fp); /* FIXME: if a previous call returns what happens to the context? */ _nss_ldap_enter(); - _nss_ldap_ent_context_release(shadow_context); + _nss_ldap_ent_context_cleanup(&context); _nss_ldap_leave(); /* we're done */ return 0; -- cgit v1.2.3