]> granicus.if.org Git - apache/commitdiff
*) mod_ldap: Avoid a segfault when result->rc is checked in uldap_connection_init
authorPaul J. Reder <rederpj@apache.org>
Tue, 16 Dec 2008 14:08:19 +0000 (14:08 +0000)
committerPaul J. Reder <rederpj@apache.org>
Tue, 16 Dec 2008 14:08:19 +0000 (14:08 +0000)
   when result is NULL. This could happen if LDAP initialization failed.
   PR 45994.  [Dan Poirier <poirier pobox.com>]

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

CHANGES
modules/ldap/util_ldap.c

diff --git a/CHANGES b/CHANGES
index f2c1a96f5badb97235075e6964a7a0eb1788891e..1564ad51babf0a070c6d3aabdb041e75d1b9db31 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.1
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) mod_ldap: Avoid a segfault when result->rc is checked in uldap_connection_init
+     when result is NULL. This could happen if LDAP initialization failed.
+     PR 45994.  [Dan Poirier <poirier pobox.com>]
+
   *) mod_cache: Correctly save Content-Encoding of cachable entity. PR 46401
      [Dan Poirier <poirier pobox.com>]
 
index ce18645525b51e81703c1540c26e969c67a20dee..062bcfbe54e7df6a510b44c2e604cb25229ce98e 100644 (file)
@@ -292,7 +292,16 @@ static int uldap_connection_init(request_rec *r,
                   APR_LDAP_NONE,
                   &(result));
 
-    if (result != NULL && result->rc) {
+    if (NULL == result) {
+        /* something really bad happened */
+        ldc->bound = 0;
+        if (NULL == ldc->reason) {
+            ldc->reason = "LDAP: ldap initialization failed";
+        }
+        return(APR_EGENERAL);
+    }
+
+    if (result->rc) {
         ldc->reason = result->reason;
     }