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

Fix a segfault in the LDAP cache purge.

PR:
Obtained from:
Submitted by:	Jess Holle <jessh ptc.com>
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105206 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Graham Leggett
2004-09-19 23:00:25 +00:00
parent c9f2bc9ea6
commit f95b63e596
2 changed files with 10 additions and 4 deletions

View File

@@ -2,6 +2,8 @@ Changes with Apache 2.1.0-dev
[Remove entries to the current 2.0 section below, when backported] [Remove entries to the current 2.0 section below, when backported]
*) Fix a segfault in the LDAP cache purge. [Jess Holle <jessh ptc.com>]
*) mod_rewrite: Handle per-location rules when r->filename is unset. *) mod_rewrite: Handle per-location rules when r->filename is unset.
Previously this would segfault or simply not match as expected, Previously this would segfault or simply not match as expected,
depending on the platform. [Jeff Trawick] depending on the platform. [Jeff Trawick]

View File

@@ -173,7 +173,7 @@ unsigned long util_ald_hash_string(int nstr, ...)
void util_ald_cache_purge(util_ald_cache_t *cache) void util_ald_cache_purge(util_ald_cache_t *cache)
{ {
unsigned long i; unsigned long i;
util_cache_node_t *p, *q; util_cache_node_t *p, *q, **pp;
apr_time_t t; apr_time_t t;
if (!cache) if (!cache)
@@ -184,7 +184,8 @@ void util_ald_cache_purge(util_ald_cache_t *cache)
cache->numpurges++; cache->numpurges++;
for (i=0; i < cache->size; ++i) { for (i=0; i < cache->size; ++i) {
p = cache->nodes[i]; pp = cache->nodes + i;
p = *pp;
while (p != NULL) { while (p != NULL) {
if (p->add_time < cache->marktime) { if (p->add_time < cache->marktime) {
q = p->next; q = p->next;
@@ -192,10 +193,11 @@ void util_ald_cache_purge(util_ald_cache_t *cache)
util_ald_free(cache, p); util_ald_free(cache, p);
cache->numentries--; cache->numentries--;
cache->npurged++; cache->npurged++;
p = q; p = *pp = q;
} }
else { else {
p = p->next; pp = &(p->next);
p = *pp;
} }
} }
} }
@@ -252,6 +254,8 @@ util_url_node_t *util_ald_create_caches(util_ldap_state_t *st, const char *url)
newcurl = util_ald_cache_insert(st->util_ldap_cache, &curl); newcurl = util_ald_cache_insert(st->util_ldap_cache, &curl);
} }
else
newcurl = NULL;
return newcurl; return newcurl;
} }