autofs-5.0.6 - fix result null check in read_one_map()
From: Ian Kent <ikent@redhat.com>
Fix the check and reset to NULL of the LDAP library allocated result
within the loop to fetch paged query values.
---
CHANGELOG | 1 +
modules/lookup_ldap.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 946a196..66b804f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@
- improve mount location error reporting.
- fix paged query more results check.
- fix dumpmaps not reading maps.
+- fix result null check in read_one_map().
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index a25050a..22ff355 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -2381,8 +2381,10 @@ static int read_one_map(struct autofs_point *ap,
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;
@@ -2402,6 +2404,8 @@ static int read_one_map(struct autofs_point *ap,
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);
@@ -2419,6 +2423,7 @@ static int read_one_map(struct autofs_point *ap,
return NSS_STATUS_NOTFOUND;
}
ldap_msgfree(sp.result);
+ sp.result = NULL;
} while (sp.morePages == TRUE);
debug(ap->logopt, MODPREFIX "done updating map");