diff --git a/CHANGES b/CHANGES index 92d4634b94..c34032f4c0 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 b87bae2e9a..5d41aa6f5a 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();