File autofs-5.0.6-fix-result-null-check-in-read_one_map.patch of Package autofs.import5769

commit 9f19db35bd9ee9a96728c61da2bb20f6354035ec
Author: Ian Kent <ikent@redhat.com>
Date:   Thu Dec 1 14:54:24 2011 +0800

    autofs-5.0.6 - fix result null check in read_one_map()
    
    Fix the check and reset to NULL of the LDAP library allocated result
    within the loop to fetch paged query values.

Index: autofs-5.0.5/CHANGELOG
===================================================================
--- autofs-5.0.5.orig/CHANGELOG
+++ autofs-5.0.5/CHANGELOG
@@ -82,6 +82,7 @@
 - fix ipv6 name for lookup fix.
 - fix paged query more results check.
 - fix dumpmaps not reading maps.
+- fix result null check in read_one_map().
 
 03/09/2009 autofs-5.0.5
 -----------------------
Index: autofs-5.0.5/modules/lookup_ldap.c
===================================================================
--- autofs-5.0.5.orig/modules/lookup_ldap.c
+++ autofs-5.0.5/modules/lookup_ldap.c
@@ -2360,8 +2360,10 @@ static int read_one_map(struct autofs_po
 
 		if (rv == LDAP_ADMINLIMIT_EXCEEDED ||
 		    rv == LDAP_SIZELIMIT_EXCEEDED) {
-			if (sp.result)
+			if (sp.result) {
 				ldap_msgfree(sp.result);
+				sp.result = NULL;
+			}
 			if (sp.cookie) {
 				ber_bvfree(sp.cookie);
 				sp.cookie = NULL;
@@ -2381,6 +2383,8 @@ static int read_one_map(struct autofs_po
 		if (rv != LDAP_SUCCESS || !sp.result) {
 			unbind_ldap_connection(ap->logopt, sp.ldap, ctxt);
 			*result_ldap = rv;
+			if (sp.result)
+				ldap_msgfree(sp.result);
 			if (sp.cookie)
 				ber_bvfree(sp.cookie);
 			free(sp.query);
@@ -2398,6 +2402,7 @@ static int read_one_map(struct autofs_po
 			return NSS_STATUS_NOTFOUND;
 		}
 		ldap_msgfree(sp.result);
+		sp.result = NULL;
 	} while (sp.morePages == TRUE);
 
 	debug(ap->logopt, MODPREFIX "done updating map");
openSUSE Build Service is sponsored by