Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/shadow.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2007-09-07 22:51:46 +0200
committerArthur de Jong <arthur@arthurdejong.org>2007-09-07 22:51:46 +0200
commit30423d96ecd243663906a3a1c13f1f0e90ac6330 (patch)
treeed94021c35b761bc355e7bec8cf4ce4379fe9c86 /nslcd/shadow.c
parent6592036689c38566acbafc178e1f22098279263f (diff)
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
Diffstat (limited to 'nslcd/shadow.c')
-rw-r--r--nslcd/shadow.c9
1 files changed, 4 insertions, 5 deletions
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;