From 6bdd24fe2857258515496a6eedd7ee8650144582 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sun, 24 May 2009 08:56:33 +0000 Subject: support multiple search bases, partially based on a patch by Leigh Wedding git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@892 ef36b2f9-881f-0410-afb5-c4e39611909c --- nslcd/common.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'nslcd/common.h') 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) \ -- cgit v1.2.3