1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Keep track of the number of attributes retrieved from LDAP so that all the values can be properly cached even if the value is NULL. [PR 33901]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@156587 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bradley Nicholes
2005-03-09 00:15:01 +00:00
parent 49ff90cbe3
commit a92c5fa98c
4 changed files with 26 additions and 8 deletions

View File

@@ -159,18 +159,22 @@ void *util_ldap_search_node_copy(util_ald_cache_t *cache, void *c)
/* copy vals */
if (node->vals) {
int k = 0;
int k = node->numvals;
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;
newnode->numvals = node->numvals;
for (;k;k--) {
if (node->vals[i]) {
if (!(newnode->vals[i] = util_ald_strdup(cache, node->vals[i]))) {
util_ldap_search_node_free(cache, newnode);
return NULL;
}
}
else
newnode->vals[i] = NULL;
i++;
}
}
@@ -200,9 +204,12 @@ void util_ldap_search_node_free(util_ald_cache_t *cache, void *n)
{
int i = 0;
util_search_node_t *node = (util_search_node_t *)n;
int k = node->numvals;
if (node->vals) {
while (node->vals[i]) {
util_ald_free(cache, node->vals[i++]);
for (;k;k--,i++) {
if (node->vals[i]) {
util_ald_free(cache, node->vals[i]);
}
}
util_ald_free(cache, node->vals);
}