Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 77

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

autofs-5.0.1 - fix paged ldap map read

From: Ian Kent <raven@themaw.net>

With certain LDAP configurations autofs can loop indefinitely
when trying to perform a paged result query to get the map.
---

 modules/lookup_ldap.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)


--- autofs-5.0.1.orig/modules/lookup_ldap.c
+++ autofs-5.0.1/modules/lookup_ldap.c
@@ -2373,27 +2373,22 @@ static int read_one_map(struct autofs_po
 	      MODPREFIX "searching for \"%s\" under \"%s\"", sp.query, ctxt->qdn);
 
 	sp.cookie = NULL;
-	sp.pageSize = 1000;
+	sp.pageSize = 2000;
 	sp.morePages = FALSE;
 	sp.totalCount = 0;
 	sp.result = NULL;
 
 	do {
 		rv = do_paged_query(&sp, ctxt);
-		if (rv == LDAP_SIZELIMIT_EXCEEDED) {
-			debug(ap->logopt, MODPREFIX "result size exceed");
-			if (sp.result)
-				ldap_msgfree(sp.result);
-			continue;
-		}
 
-		if (rv == LDAP_ADMINLIMIT_EXCEEDED) {
+		if (rv == LDAP_ADMINLIMIT_EXCEEDED ||
+		    rv == LDAP_SIZELIMIT_EXCEEDED) {
 			if (sp.result)
 				ldap_msgfree(sp.result);
 			sp.pageSize = sp.pageSize / 2;
 			if (sp.pageSize < 5) {
 				debug(ap->logopt, MODPREFIX
-				      "administrative result size too small");
+				      "result size too small");
 				unbind_ldap_connection(ap->logopt, sp.ldap, ctxt);
 				*result_ldap = rv;
 				free(sp.query);