Bug 33901 - util_ldap_cache_getuserdn can't cache attribute values
Summary: util_ldap_cache_getuserdn can't cache attribute values
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_ldap (show other bugs)
Version: 2.0.53
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2005-03-08 13:27 UTC by Kaoru Sekiguchi
Modified: 2005-09-08 15:51 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Kaoru Sekiguchi 2005-03-08 13:27:58 UTC
When I passed the several attibutes as the attrs argument to 
util_ldap_cache_getuserdn and the first attribute value from a LDAP entry was 
null, all attribute values weren't cached.

I think that the following codes in util_ldap_cache.c are causes.
If node->vals[0] is null, all node->vals[i] aren't copied to cache.

void *util_ldap_search_node_copy(util_ald_cache_t *cache, void *c)
        /* copy vals */
        if (node->vals) {
            int k = 0;
            int i = 0;
            while (node->vals[k++]);
            if (!(newnode->vals = util_ald_alloc(cache, sizeof(char *) * 
(k+1)))) {
                util_ldap_search_node_free(cache, newnode);
                return NULL;
            while (node->vals[i]) {
                if (!(newnode->vals[i] = util_ald_strdup(cache, node->vals
[i]))) {
                    util_ldap_search_node_free(cache, newnode);
                    return NULL;
Comment 1 Brad Nicholes 2005-03-09 01:18:07 UTC
Fixed in 2.1/2.2 version of util_ldap.  The number of attributes is stored 
along with the values so that the code can rely on an actual count rather than 
terminating at the first NULL value.
Comment 2 Brad Nicholes 2005-09-08 23:51:53 UTC
*** Bug 36563 has been marked as a duplicate of this bug. ***