From 43c90c9facf85ed0d48b2f076496188850748682 Mon Sep 17 00:00:00 2001 From: "Paul J. Reder" Date: Tue, 16 Dec 2008 14:08:19 +0000 Subject: [PATCH] *) 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 --- CHANGES | 4 ++++ modules/ldap/util_ldap.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index f2c1a96f5b..1564ad51ba 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 ce18645525..062bcfbe54 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; } -- 2.40.0