]> granicus.if.org Git - apache/commitdiff
Fix a potential segfault if the bind password in the LDAP cache
authorGraham Leggett <minfrin@apache.org>
Fri, 21 May 2004 15:02:44 +0000 (15:02 +0000)
committerGraham Leggett <minfrin@apache.org>
Fri, 21 May 2004 15:02:44 +0000 (15:02 +0000)
is NULL.
PR: 26686
Obtained from:
Submitted by: Jari Ahonen <jah@progress.com>
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103713 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/experimental/util_ldap_cache.c

diff --git a/CHANGES b/CHANGES
index 4fda184dca746c01f492c81751cfea0528f6ef12..fedc7cabd3c7016fe3c89d06333dc4a146426bb7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Fix a potential segfault if the bind password in the LDAP cache
+     is NULL. PR 26686 [Jari Ahonen <jah@progress.com>]
+
   *) Quotes cannot be used around require group and require dn
      directives, update the documentation to reflect this. Also add
      quotes around the dn and group within debug messages, to make it
index ac40694480b5644497bcad7eddc498a348a73c29..66206079cc87c4c4178a915da26ad6f3f794bb34 100644 (file)
@@ -122,11 +122,18 @@ void *util_ldap_search_node_copy(util_ald_cache_t *cache, void *c)
             newnode->vals = NULL;
         }
         if (!(newnode->username = util_ald_strdup(cache, node->username)) ||
-            !(newnode->dn = util_ald_strdup(cache, node->dn)) ||
-            !(newnode->bindpw = util_ald_strdup(cache, node->bindpw)) ) {
+            !(newnode->dn = util_ald_strdup(cache, node->dn)) ) {
             util_ldap_search_node_free(cache, newnode);
             return NULL;
         }
+        if(node->bindpw) {
+            if(!(newnode->bindpw = util_ald_strdup(cache, node->bindpw))) {
+                util_ldap_search_node_free(cache, newnode);
+                return NULL;
+            }
+        } else {
+            newnode->bindpw = NULL;
+        }
         newnode->lastbind = node->lastbind;
 
     }