-*- coding: utf-8 -*-
Changes with Apache 2.2.7
+ *) 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]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_ldap: Don't return references into shared memory to the caller,
- as these may expire at any time because callers don't hold
- a cache lock
- http://svn.apache.org/viewvc?view=rev&revision=591499
- http://svn.apache.org/viewvc?view=rev&revision=593919
- +1: covener, rpluem, rederpj
- rederpj: Though it should never be a problem (famous last words), should
- there be some sort of verification of i vs. k? (since you
- allocate based on k and copy based on i)
- covener: attrs/vals are defined as being the same length and null terminated,
- we just need to count the length of one to allocate the other
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
&& (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;