Changes with Apache 2.3.0
[ When backported to 2.2.x, remove entry from this file ]
+ *) mod_ldap: Give callers a reference to data copied into the request
+ pool instead of references directly into the cache
+ PR 43786 [Eric Covener]
+
*) mod_ldap: Stop passing a reference to pconf around for
(limited) use during request processing, avoiding possible
memory corruption and crashes. [Eric Covener]
&& (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;
}
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;