From: Paul J. Reder Date: Tue, 16 Dec 2008 14:08:19 +0000 (+0000) Subject: *) mod_ldap: Avoid a segfault when result->rc is checked in uldap_connection_init X-Git-Tag: 2.3.1~115 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=43c90c9facf85ed0d48b2f076496188850748682;p=thirdparty%2Fapache%2Fhttpd.git *) 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 ] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@727053 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index f2c1a96f5ba..1564ad51bab 100644 --- 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 ] + *) mod_cache: Correctly save Content-Encoding of cachable entity. PR 46401 [Dan Poirier ] diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c index ce18645525b..062bcfbe54e 100644 --- a/modules/ldap/util_ldap.c +++ b/modules/ldap/util_ldap.c @@ -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; }