Skip to contentSkip to conversation

check the return code from ldap_parse_result

PATCH New Jeff Moyer 1 participant 1 message Sep 4, 2009 Kernel automounter

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 check the return code from ldap_parse_result

Hi, Ian,

Here's another trivialish patch. If ldap_parse_result returns anything other than LDAP_SUCCESS, the values of the result pointers are undefined.

Cheers,
Jeff

modules/lookup_ldap.c +7 -1
index d0cbdca..33ca23e 100644
@@ -2017,6 +2017,12 @@ do_paged:
 		sp->cookie = NULL;
 	}
 
+	if (rv != LDAP_SUCCESS) {
+		debug(ap->logopt,
+		      MODPREFIX "ldap_parse_result failed with %d", rv);
+		goto out_free;
+	}
+
 	/*
 	 * Parse the page control returned to get the cookie and
 	 * determine whether there are more pages.
@@ -2033,8 +2039,8 @@ do_paged:
 	if (returnedControls)
 		ldap_controls_free(returnedControls);
 
+out_free:
 	ldap_control_free(pageControl);
-
 	return rv;
 }