From: Graham Leggett Date: Sun, 19 Sep 2004 23:00:25 +0000 (+0000) Subject: Fix a segfault in the LDAP cache purge. X-Git-Tag: 2.1.1~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f95b63e596a76dc133c474c3dd47b8704f354a39;p=thirdparty%2Fapache%2Fhttpd.git Fix a segfault in the LDAP cache purge. PR: Obtained from: Submitted by: Jess Holle Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105206 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 301fa57ec80..f13a41bc7ef 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) Fix a segfault in the LDAP cache purge. [Jess Holle ] + *) mod_rewrite: Handle per-location rules when r->filename is unset. Previously this would segfault or simply not match as expected, depending on the platform. [Jeff Trawick] diff --git a/modules/ldap/util_ldap_cache_mgr.c b/modules/ldap/util_ldap_cache_mgr.c index a4268988550..a2fd5b08201 100644 --- a/modules/ldap/util_ldap_cache_mgr.c +++ b/modules/ldap/util_ldap_cache_mgr.c @@ -173,7 +173,7 @@ unsigned long util_ald_hash_string(int nstr, ...) void util_ald_cache_purge(util_ald_cache_t *cache) { unsigned long i; - util_cache_node_t *p, *q; + util_cache_node_t *p, *q, **pp; apr_time_t t; if (!cache) @@ -184,7 +184,8 @@ void util_ald_cache_purge(util_ald_cache_t *cache) cache->numpurges++; for (i=0; i < cache->size; ++i) { - p = cache->nodes[i]; + pp = cache->nodes + i; + p = *pp; while (p != NULL) { if (p->add_time < cache->marktime) { q = p->next; @@ -192,10 +193,11 @@ void util_ald_cache_purge(util_ald_cache_t *cache) util_ald_free(cache, p); cache->numentries--; cache->npurged++; - p = q; + p = *pp = q; } 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); } + else + newcurl = NULL; return newcurl; }