summaryrefslogtreecommitdiffstats
path: root/modules/ldap
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2007-11-02 23:33:36 +0100
committerEric Covener <covener@apache.org>2007-11-02 23:33:36 +0100
commit6f970f48dc698291769a48961bad78de07eba868 (patch)
tree11639587aa65251707b4249374bc59e47f058c74 /modules/ldap
parentfix pool misuse around mod_ldap's connection cache, previously pconf (diff)
downloadapache2-6f970f48dc698291769a48961bad78de07eba868.tar.xz
apache2-6f970f48dc698291769a48961bad78de07eba868.zip
spurious 401s with message "DN has not been defined" when cache expiration happens in another thread
PR 43786 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@591499 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/ldap')
-rw-r--r--modules/ldap/util_ldap.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c
index 917e5c9fea..a0900a16e0 100644
--- a/modules/ldap/util_ldap.c
+++ b/modules/ldap/util_ldap.c
@@ -1208,8 +1208,16 @@ static int uldap_cache_checkuserid(request_rec *r, util_ldap_connection_t *ldc,
&& (strcmp(search_nodep->bindpw, bindpw) == 0))
{
/* ...and entry is valid */
- *binddn = search_nodep->dn;
- *retvals = search_nodep->vals;
+ *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++;
+ }
+ }
LDAP_CACHE_UNLOCK();
ldc->reason = "Authentication successful (cached)";
return LDAP_SUCCESS;
@@ -1448,8 +1456,16 @@ static int uldap_cache_getuserdn(request_rec *r, util_ldap_connection_t *ldc,
}
else {
/* ...and entry is valid */
- *binddn = search_nodep->dn;
- *retvals = search_nodep->vals;
+ *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++;
+ }
+ }
LDAP_CACHE_UNLOCK();
ldc->reason = "Search successful (cached)";
return LDAP_SUCCESS;