Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/common.h
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2009-05-24 10:56:33 +0200
committerArthur de Jong <arthur@arthurdejong.org>2009-05-24 10:56:33 +0200
commit6bdd24fe2857258515496a6eedd7ee8650144582 (patch)
treef6a37aa31062c567f528d13a0eafa6c2dd22c7d8 /nslcd/common.h
parentd50fe928bb5526892f091f0ff287ec449b9b66be (diff)
support multiple search bases, partially based on a patch by Leigh Wedding <lwedding@bigpond.com>
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@892 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/common.h')
-rw-r--r--nslcd/common.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/nslcd/common.h b/nslcd/common.h
index 8d91a2c..3503e59 100644
--- a/nslcd/common.h
+++ b/nslcd/common.h
@@ -3,7 +3,7 @@
This file is part of the nss-ldapd library.
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007, 2008 Arthur de Jong
+ Copyright (C) 2006, 2007, 2008, 2009 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
@@ -126,7 +126,8 @@ int nslcd_shadow_all(TFILE *fp,MYLDAP_SESSION *session);
int32_t tmpint32; \
MYLDAP_SEARCH *search; \
MYLDAP_ENTRY *entry; \
- int rc; \
+ const char *base; \
+ int rc,i; \
/* read request parameters */ \
readfn; \
/* log call */ \
@@ -142,14 +143,18 @@ int nslcd_shadow_all(TFILE *fp,MYLDAP_SESSION *session);
} \
/* build the list of attributes */ \
db##_init(); \
- /* do the LDAP search */ \
- if ((search=myldap_search(session,db##_base,db##_scope,filter,db##_attrs))==NULL) \
- return -1; \
- /* go over results */ \
- while ((entry=myldap_get_entry(search,&rc))!=NULL) \
+ /* perform a search for each search base */ \
+ for (i=0; (base=db##_bases[i])!=NULL; i++) \
{ \
- if (writefn) \
+ /* do the LDAP search */ \
+ if ((search=myldap_search(session,base,db##_scope,filter,db##_attrs))==NULL) \
return -1; \
+ /* go over results */ \
+ while ((entry=myldap_get_entry(search,&rc))!=NULL) \
+ { \
+ if (writefn) \
+ return -1; \
+ } \
} \
/* write the final result code */ \
if (rc==LDAP_SUCCESS) \