From: Eric Covener Date: Tue, 23 Feb 2010 12:07:03 +0000 (+0000) Subject: mod_ldap: Eliminate a potential crash with multiple LDAPTrustedClientCert when X-Git-Tag: 2.3.6~446 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a0ea94ac1505d471f085b3d265ac6e554950a15;p=apache mod_ldap: Eliminate a potential crash with multiple LDAPTrustedClientCert when some are not password-protected. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@915295 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 96088f9d71..682ef61224 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.7 + *) mod_ldap: Eliminate a potential crash with multiple LDAPTrustedClientCert + when some are not password-protected. [Eric Covener] + *) Fix startup segfault when the Mutex directive is used but no loaded modules use httpd mutexes. PR 48787. [Jeff Trawick] diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c index b3a42bede2..b6f3a35b55 100644 --- a/modules/ldap/util_ldap.c +++ b/modules/ldap/util_ldap.c @@ -625,9 +625,12 @@ static int compare_client_certs(apr_array_header_t *srcs, src = (struct apr_ldap_opt_tls_cert_t *)srcs->elts; dest = (struct apr_ldap_opt_tls_cert_t *)dests->elts; for (i = 0; i < srcs->nelts; i++) { - if (strcmp(src[i].path, dest[i].path) || - strcmp(src[i].password, dest[i].password) || - src[i].type != dest[i].type) { + if ((strcmp(src[i].path, dest[i].path)) || + (src[i].type != dest[i].type) || + /* One is passwordless? If so, then not equal */ + ((src[i].password == NULL) ^ (dest[i].password == NULL)) || + (src[i].password != NULL && dest[i].password != NULL && + strcmp(src[i].password, dest[i].password))) { return 1; } }