From: Eric Covener Date: Fri, 7 Mar 2008 21:02:41 +0000 (+0000) Subject: * mod_ldap: Correctly return all requested attribute values X-Git-Tag: 2.3.0~893 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ac9128120ef6c07c9e3dc13d294c4f3af825ca7;p=thirdparty%2Fapache%2Fhttpd.git * mod_ldap: Correctly return all requested attribute values when some attributes have a null value. PR: 44560 Submitted by: Anders Kaseorg Reviewed by: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@634821 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 92d4634b942..c34032f4c08 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + + *) mod_ldap: Correctly return all requested attribute values + when some attributes have a null value. + PR 44560 [Anders Kaseorg ] *) core: check symlink ownership if both FollowSymlinks and SymlinksIfOwnerMatch are set [Nick Kew] diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c index b87bae2e9a5..5d41aa6f5ae 100644 --- a/modules/ldap/util_ldap.c +++ b/modules/ldap/util_ldap.c @@ -1462,13 +1462,10 @@ static int uldap_cache_checkuserid(request_rec *r, util_ldap_connection_t *ldc, /* ...and entry is valid */ *binddn = apr_pstrdup(r->pool, search_nodep->dn); if (attrs) { - int i = 0, k = 0; - while (attrs[k++]); - *retvals = apr_pcalloc(r->pool, sizeof(char *) * k); - while (search_nodep->vals[i]) { - (*retvals)[i] = apr_pstrdup(r->pool, - search_nodep->vals[i]); - i++; + int i; + *retvals = apr_pcalloc(r->pool, sizeof(char *) * search_nodep->numvals); + for (i = 0; i < search_nodep->numvals; i++) { + (*retvals)[i] = apr_pstrdup(r->pool, search_nodep->vals[i]); } } LDAP_CACHE_UNLOCK(); @@ -1712,13 +1709,10 @@ static int uldap_cache_getuserdn(request_rec *r, util_ldap_connection_t *ldc, /* ...and entry is valid */ *binddn = apr_pstrdup(r->pool, search_nodep->dn); if (attrs) { - int i = 0, k = 0; - while (attrs[k++]); - *retvals = apr_pcalloc(r->pool, sizeof(char *) * k); - while (search_nodep->vals[i]) { - (*retvals)[i] = apr_pstrdup(r->pool, - search_nodep->vals[i]); - i++; + int i; + *retvals = apr_pcalloc(r->pool, sizeof(char *) * search_nodep->numvals); + for (i = 0; i < search_nodep->numvals; i++) { + (*retvals)[i] = apr_pstrdup(r->pool, search_nodep->vals[i]); } } LDAP_CACHE_UNLOCK();