From 6be6d1dd25f2e7f2f1de6c0091e9aeae2ea1918c Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Thu, 22 Jul 2004 16:55:14 +0000 Subject: - Fixed uninitialized memory bug - Imported updated sock_any and hash code --- ChangeLog | 5 ++ common/hash.c | 200 ++++++++++++++++++++++++++--------------------------- common/hash.h | 136 ++++++++++++++++++------------------ common/sock_any.c | 91 ++++++++++++++++++++++-- common/sock_any.h | 59 +++++++++++++++- configure.in | 4 +- daemon/httpauthd.c | 5 +- daemon/ldap.c | 44 ++++++------ daemon/ntlm.c | 40 +++++------ daemon/simple.c | 30 ++++---- 10 files changed, 377 insertions(+), 237 deletions(-) diff --git a/ChangeLog b/ChangeLog index a690c1c..3db63b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +0.4.1 + - Fix unititialized memory bug + - Fixed address parsing and formatting bugs + - Fixed hash table bugs + 0.4 - Better reconnection after a closed connection from mod_httpauth - Fixed LDAP bind type authentication bug diff --git a/common/hash.c b/common/hash.c index 9bbe8ac..5f3308c 100644 --- a/common/hash.c +++ b/common/hash.c @@ -22,11 +22,11 @@ #include #include "hash.h" -#ifdef HASH_TIMESTAMP +#ifdef HSH_TIMESTAMP #include #endif -#ifdef HASH_COPYKEYS +#ifdef HSH_COPYKEYS #define KEY_DATA(he) (void*)(((unsigned char*)(he)) + sizeof(*(he))) #else #define KEY_DATA(he) ((he)->key) @@ -41,18 +41,18 @@ * isn't too bad given that pools have a low allocation overhead. */ -typedef struct hash_entry_t hash_entry_t; +typedef struct hsh_entry_t hsh_entry_t; -struct hash_entry_t +struct hsh_entry_t { - hash_entry_t* next; + hsh_entry_t* next; unsigned int hash; -#ifndef HASH_COPYKEYS +#ifndef HSH_COPYKEYS const void* key; size_t klen; #endif const void* val; -#ifdef HASH_TIMESTAMP +#ifdef HSH_TIMESTAMP time_t stamp; #endif }; @@ -62,13 +62,13 @@ struct hash_entry_t * * We keep a pointer to the next hash entry here to allow the current * hash entry to be freed or otherwise mangled between calls to - * hash_next(). + * hsh_next(). */ -struct hash_index_t +struct hsh_index_t { - hash_t* ht; - hash_entry_t* ths; - hash_entry_t* next; + hsh_t* ht; + hsh_entry_t* ths; + hsh_entry_t* next; unsigned int index; }; @@ -79,30 +79,30 @@ struct hash_index_t * The count of hash entries may be greater depending on the chosen * collision rate. */ -struct hash_t +struct hsh_t { - hash_entry_t** array; - hash_index_t iterator; /* For hash_first(...) */ + hsh_entry_t** array; + hsh_index_t iterator; /* For hsh_first(...) */ unsigned int count; unsigned int max; -#ifdef HASH_COPYKEYS +#ifdef HSH_COPYKEYS unsigned int klen; #endif -#ifdef HASH_CALLBACKS - hash_table_calls_t calls; +#ifdef HSH_CALLBACKS + hsh_table_calls_t calls; #endif }; #define INITIAL_MAX 15 /* tunable == 2^n - 1 */ -#ifdef HASH_CALLBACKS +#ifdef HSH_CALLBACKS /* A copy of the memory call table we've been set to */ -static hash_memory_calls_t g_memory_calls_cpy; +static hsh_memory_calls_t g_memory_calls_cpy; /* Pointer to above. This indicates when we actually are set */ -static hash_memory_calls_t* g_memory_calls = NULL; +static hsh_memory_calls_t* g_memory_calls = NULL; static void* int_malloc(size_t len) { @@ -131,7 +131,7 @@ static void int_free(void* ptr) free(ptr); } -void hash_set_memory_calls(hash_memory_calls_t* hmc) +void hsh_set_memory_calls(hsh_memory_calls_t* hmc) { if(hmc == NULL) { @@ -144,7 +144,7 @@ void hash_set_memory_calls(hash_memory_calls_t* hmc) } } -void hash_set_table_calls(hash_t* ht, hash_table_calls_t* htc) +void hsh_set_table_calls(hsh_t* ht, hsh_table_calls_t* htc) { memcpy(&(ht->calls), htc, sizeof(ht->calls)); } @@ -161,24 +161,24 @@ void hash_set_table_calls(hash_t* ht, hash_table_calls_t* htc) * Hash creation functions. */ -static hash_entry_t** alloc_array(hash_t* ht, unsigned int max) +static hsh_entry_t** alloc_array(hsh_t* ht, unsigned int max) { - return int_malloc(sizeof(*(ht->array)) * (max + 1)); + return int_calloc(sizeof(*(ht->array)) * (max + 1)); } -#ifdef HASH_COPYKEYS -hash_t* hash_create(size_t klen) +#ifdef HSH_COPYKEYS +hsh_t* hsh_create(size_t klen) #else -hash_t* hash_create() +hsh_t* hsh_create() #endif { - hash_t* ht = int_malloc(sizeof(hash_t)); + hsh_t* ht = int_malloc(sizeof(hsh_t)); if(ht) { ht->count = 0; ht->max = INITIAL_MAX; ht->array = alloc_array(ht, ht->max); -#ifdef HASH_COPYKEYS +#ifdef HSH_COPYKEYS ht->klen = klen; #endif if(!ht->array) @@ -190,13 +190,13 @@ hash_t* hash_create() return ht; } -void hash_free(hash_t* ht) +void hsh_free(hsh_t* ht) { - hash_index_t* hi; + hsh_index_t* hi; - for(hi = hash_first(ht); hi; hi = hash_next(hi)) + for(hi = hsh_first(ht); hi; hi = hsh_next(hi)) { -#ifdef HASH_CALLBACKS +#ifdef HSH_CALLBACKS if(hi->ths->val && ht->calls.f_freeval) (ht->calls.f_freeval)(ht->calls.arg, (void*)hi->ths->val); #endif @@ -213,7 +213,7 @@ void hash_free(hash_t* ht) * Hash iteration functions. */ -hash_index_t* hash_next(hash_index_t* hi) +hsh_index_t* hsh_next(hsh_index_t* hi) { hi->ths = hi->next; while(!hi->ths) @@ -227,27 +227,27 @@ hash_index_t* hash_next(hash_index_t* hi) return hi; } -hash_index_t* hash_first(hash_t* ht) +hsh_index_t* hsh_first(hsh_t* ht) { - hash_index_t* hi = &ht->iterator; + hsh_index_t* hi = &ht->iterator; hi->ht = ht; hi->index = 0; hi->ths = NULL; hi->next = NULL; - return hash_next(hi); + return hsh_next(hi); } -#ifdef HASH_COPYKEYS -void* hash_this(hash_index_t* hi, const void** key) +#ifdef HSH_COPYKEYS +void* hsh_this(hsh_index_t* hi, const void** key) #else -void* hash_this(hash_index_t* hi, const void** key, size_t* klen) +void* hsh_this(hsh_index_t* hi, const void** key, size_t* klen) #endif { if(key) *key = KEY_DATA(hi->ths); -#ifndef HASH_COPYKEYS +#ifndef HSH_COPYKEYS if(klen) *klen = hi->ths->klen; #endif @@ -260,10 +260,10 @@ void* hash_this(hash_index_t* hi, const void** key, size_t* klen) * Expanding a hash table */ -static int expand_array(hash_t* ht) +static int expand_array(hsh_t* ht) { - hash_index_t* hi; - hash_entry_t** new_array; + hsh_index_t* hi; + hsh_entry_t** new_array; unsigned int new_max; new_max = ht->max * 2 + 1; @@ -272,7 +272,7 @@ static int expand_array(hash_t* ht) if(!new_array) return 0; - for(hi = hash_first(ht); hi; hi = hash_next(hi)) + for(hi = hsh_first(ht); hi; hi = hsh_next(hi)) { unsigned int i = hi->ths->hash & new_max; hi->ths->next = new_array[i]; @@ -296,19 +296,19 @@ static int expand_array(hash_t* ht) * that hash entries can be removed. */ -#ifdef HASH_COPYKEYS -static hash_entry_t** find_entry(hash_t* ht, const void* key, const void* val) +#ifdef HSH_COPYKEYS +static hsh_entry_t** find_entry(hsh_t* ht, const void* key, const void* val) #else -static hash_entry_t** find_entry(hash_t* ht, const void* key, size_t klen, const void* val) +static hsh_entry_t** find_entry(hsh_t* ht, const void* key, size_t klen, const void* val) #endif { - hash_entry_t** hep; - hash_entry_t* he; + hsh_entry_t** hep; + hsh_entry_t* he; const unsigned char* p; unsigned int hash; size_t i; -#ifdef HASH_COPYKEYS +#ifdef HSH_COPYKEYS size_t klen = ht->klen; #endif @@ -351,8 +351,8 @@ static hash_entry_t** find_entry(hash_t* ht, const void* key, size_t klen, const */ hash = 0; -#ifndef HASH_COPYKEYS - if(klen == HASH_KEY_STRING) +#ifndef HSH_COPYKEYS + if(klen == HSH_KEY_STRING) { for(p = key; *p; p++) hash = hash * 33 + *p; @@ -371,7 +371,7 @@ static hash_entry_t** find_entry(hash_t* ht, const void* key, size_t klen, const he; hep = &he->next, he = *hep) { if(he->hash == hash && -#ifndef HASH_COPYKEYS +#ifndef HSH_COPYKEYS he->klen == klen && #endif memcmp(KEY_DATA(he), key, klen) == 0) @@ -382,7 +382,7 @@ static hash_entry_t** find_entry(hash_t* ht, const void* key, size_t klen, const return hep; /* add a new entry for non-NULL val */ -#ifdef HASH_COPYKEYS +#ifdef HSH_COPYKEYS he = int_malloc(sizeof(*he) + klen); #else he = int_malloc(sizeof(*he)); @@ -390,7 +390,7 @@ static hash_entry_t** find_entry(hash_t* ht, const void* key, size_t klen, const if(he) { -#ifdef HASH_COPYKEYS +#ifdef HSH_COPYKEYS /* Key data points past end of entry */ memcpy(KEY_DATA(he), key, klen); #else @@ -403,7 +403,7 @@ static hash_entry_t** find_entry(hash_t* ht, const void* key, size_t klen, const he->hash = hash; he->val = val; -#ifdef HASH_TIMESTAMP +#ifdef HSH_TIMESTAMP he->stamp = 0; #endif @@ -414,14 +414,14 @@ static hash_entry_t** find_entry(hash_t* ht, const void* key, size_t klen, const return hep; } -#ifdef HASH_COPYKEYS -void* hash_get(hash_t* ht, const void *key) +#ifdef HSH_COPYKEYS +void* hsh_get(hsh_t* ht, const void *key) { - hash_entry_t** he = find_entry(ht, key, NULL); + hsh_entry_t** he = find_entry(ht, key, NULL); #else -void* hash_get(hash_t* ht, const void *key, size_t klen) +void* hsh_get(hsh_t* ht, const void *key, size_t klen) { - hash_entry_t** he = find_entry(ht, key, klen, NULL); + hsh_entry_t** he = find_entry(ht, key, klen, NULL); #endif if(he && *he) @@ -430,19 +430,19 @@ void* hash_get(hash_t* ht, const void *key, size_t klen) return NULL; } -#ifdef HASH_COPYKEYS -int hash_set(hash_t* ht, const void* key, void* val) +#ifdef HSH_COPYKEYS +int hsh_set(hsh_t* ht, const void* key, void* val) { - hash_entry_t** hep = find_entry(ht, key, val); + hsh_entry_t** hep = find_entry(ht, key, val); #else -int hash_set(hash_t* ht, const void* key, size_t klen, void* val) +int hsh_set(hsh_t* ht, const void* key, size_t klen, void* val) { - hash_entry_t** hep = find_entry(ht, key, klen, val); + hsh_entry_t** hep = find_entry(ht, key, klen, val); #endif if(hep && *hep) { -#ifdef HASH_CALLBACKS +#ifdef HSH_CALLBACKS if((*hep)->val && (*hep)->val != val && ht->calls.f_freeval) (ht->calls.f_freeval)(ht->calls.arg, (void*)((*hep)->val)); #endif @@ -450,7 +450,7 @@ int hash_set(hash_t* ht, const void* key, size_t klen, void* val) /* replace entry */ (*hep)->val = val; -#ifdef HASH_TIMESTAMP +#ifdef HSH_TIMESTAMP /* Update or set the timestamp */ (*hep)->stamp = time(NULL); #endif @@ -468,20 +468,20 @@ int hash_set(hash_t* ht, const void* key, size_t klen, void* val) return 0; } -#ifdef HASH_COPYKEYS -void* hash_rem(hash_t* ht, const void* key) +#ifdef HSH_COPYKEYS +void* hsh_rem(hsh_t* ht, const void* key) { - hash_entry_t** hep = find_entry(ht, key, NULL); + hsh_entry_t** hep = find_entry(ht, key, NULL); #else -void* hash_rem(hash_t* ht, const void* key, size_t klen) +void* hsh_rem(hsh_t* ht, const void* key, size_t klen) { - hash_entry_t** hep = find_entry(ht, key, klen, NULL); + hsh_entry_t** hep = find_entry(ht, key, klen, NULL); #endif void* val = NULL; if(hep && *hep) { - hash_entry_t* old = *hep; + hsh_entry_t* old = *hep; *hep = (*hep)->next; --ht->count; val = (void*)old->val; @@ -491,30 +491,30 @@ void* hash_rem(hash_t* ht, const void* key, size_t klen) return val; } -unsigned int hash_count(hash_t* ht) +unsigned int hsh_count(hsh_t* ht) { return ht->count; } -#ifdef HASH_TIMESTAMP -int hash_purge(hash_t* ht, time_t stamp) +#ifdef HSH_TIMESTAMP +int hsh_purge(hsh_t* ht, time_t stamp) { - hash_index_t* hi; + hsh_index_t* hi; int r = 0; void* val; - for(hi = hash_first(ht); hi; hi = hash_next(hi)) + for(hi = hsh_first(ht); hi; hi = hsh_next(hi)) { if(hi->ths->stamp < stamp) { /* No need to check for errors as we're deleting */ -#ifdef HASH_COPYKEYS - val = hash_rem(ht, KEY_DATA(hi->ths)); +#ifdef HSH_COPYKEYS + val = hsh_rem(ht, KEY_DATA(hi->ths)); #else - val = hash_rem(ht, hi->ths->key, hi->ths->klen); + val = hsh_rem(ht, hi->ths->key, hi->ths->klen); #endif -#ifdef HASH_CALLBACKS +#ifdef HSH_CALLBACKS if(val && ht->calls.f_freeval) (ht->calls.f_freeval)(ht->calls.arg, val); #endif @@ -526,37 +526,37 @@ int hash_purge(hash_t* ht, time_t stamp) return r; } -#ifdef HASH_COPYKEYS -void hash_touch(hash_t* ht, const void* key) +#ifdef HSH_COPYKEYS +void hsh_touch(hsh_t* ht, const void* key) { - hash_entry_t** hep = find_entry(ht, key, NULL); + hsh_entry_t** hep = find_entry(ht, key, NULL); #else -void hash_touch(hash_t* ht, const void* key, size_t* klen) +void hsh_touch(hsh_t* ht, const void* key, size_t* klen) { - hash_entry_t** hep = find_entry(ht, key, klen, NULL); + hsh_entry_t** hep = find_entry(ht, key, klen, NULL); #endif if(hep && *hep) ((*hep)->stamp) = time(NULL); } -int hash_bump(hash_t* ht) +int hsh_bump(hsh_t* ht) { - hash_index_t* hi; + hsh_index_t* hi; void* key = NULL; void* val = NULL; time_t least = 0; -#ifndef HASH_COPYKEYS +#ifndef HSH_COPYKEYS size_t klen = 0; #endif - for(hi = hash_first(ht); hi; hi = hash_next(hi)) + for(hi = hsh_first(ht); hi; hi = hsh_next(hi)) { if(least == 0 || hi->ths->stamp < least) { least = hi->ths->stamp; key = KEY_DATA(hi->ths); -#ifndef HASH_COPYKEYS +#ifndef HSH_COPYKEYS klen = hi->this->klen; #endif } @@ -564,13 +564,13 @@ int hash_bump(hash_t* ht) if(key) { -#ifdef HASH_COPYKEYS - val = hash_rem(ht, key); +#ifdef HSH_COPYKEYS + val = hsh_rem(ht, key); #else - val = hash_rem(ht, key, klen); + val = hsh_rem(ht, key, klen); #endif -#ifdef HASH_CALLBACKS +#ifdef HSH_CALLBACKS if(val && ht->calls.f_freeval) (ht->calls.f_freeval)(ht->calls.arg, (void*)val); #endif @@ -581,4 +581,4 @@ int hash_bump(hash_t* ht) return 0; } -#endif /* HASH_TIMESTAMP */ +#endif /* HSH_TIMESTAMP */ diff --git a/common/hash.h b/common/hash.h index 174c209..fef2803 100644 --- a/common/hash.h +++ b/common/hash.h @@ -18,8 +18,8 @@ * limitations under the License. */ -#ifndef __HASH_H__ -#define __HASH_H__ +#ifndef __HSH_H__ +#define __HSH_H__ #ifdef __cplusplus extern "C" { @@ -35,13 +35,13 @@ extern "C" { */ /* Keep timestamps for the entries */ -#define HASH_TIMESTAMP +#define HSH_TIMESTAMP /* Keep key values internally */ -#define HASH_COPYKEYS +#define HSH_COPYKEYS /* Hash callback functionality */ -#define HASH_CALLBACKS +#define HSH_CALLBACKS /* * ARGUMENT DOCUMENTATION @@ -60,10 +60,10 @@ extern "C" { */ /* Abstract type for hash tables. */ -typedef struct hash_t hash_t; +typedef struct hsh_t hsh_t; /* Abstract type for scanning hash tables. */ -typedef struct hash_index_t hash_index_t; +typedef struct hsh_index_t hsh_index_t; /* ---------------------------------------------------------------------------------- @@ -73,60 +73,60 @@ typedef struct hash_index_t hash_index_t; * keys stored in the hashtable itself. */ -#ifdef HASH_COPYKEYS +#ifdef HSH_COPYKEYS /* - * hash_create : Create a hash table + * hsh_create : Create a hash table * - returns an allocated hashtable */ -hash_t* hash_create(size_t klen); +hsh_t* hsh_create(size_t klen); /* - * hash_free : Free a hash table + * hsh_free : Free a hash table */ -void hash_free(hash_t* ht); +void hsh_free(hsh_t* ht); /* - * hash_count: Number of values in hash table + * hsh_count: Number of values in hash table * - returns the number of entries in hash table */ -unsigned int hash_count(hash_t* ht); +unsigned int hsh_count(hsh_t* ht); /* - * hash_get: Retrieves a value from the hash table + * hsh_get: Retrieves a value from the hash table * - returns the value of the entry */ -void* hash_get(hash_t* ht, const void* key); +void* hsh_get(hsh_t* ht, const void* key); /* - * hash_set: Set a value in the hash table + * hsh_set: Set a value in the hash table * - returns 1 if the entry was added properly */ -int hash_set(hash_t* ht, const void* key, void* val); +int hsh_set(hsh_t* ht, const void* key, void* val); /* - * hash_rem: Remove a value from the hash table + * hsh_rem: Remove a value from the hash table * - returns the value of the removed entry */ -void* hash_rem(hash_t* ht, const void* key); +void* hsh_rem(hsh_t* ht, const void* key); /* - * hash_first: Start enumerating through the hash table + * hsh_first: Start enumerating through the hash table * - returns a hash iterator */ -hash_index_t* hash_first(hash_t* ht); +hsh_index_t* hsh_first(hsh_t* ht); /* - * hash_next: Enumerate through hash table + * hsh_next: Enumerate through hash table * - returns the hash iterator or null when no more entries */ -hash_index_t* hash_next(hash_index_t* hi); +hsh_index_t* hsh_next(hsh_index_t* hi); /* - * hash_this: While enumerating get current value + * hsh_this: While enumerating get current value * - returns the value that the iterator currently points to */ -void* hash_this(hash_index_t* hi, const void** key); +void* hsh_this(hsh_index_t* hi, const void** key); @@ -140,63 +140,63 @@ void* hash_this(hash_index_t* hi, const void** key); #else /* - * hash_create : Create a hash table + * hsh_create : Create a hash table * - returns an allocated hashtable */ -hash_t* hash_create(); +hsh_t* hsh_create(); /* - * hash_free : Free a hash table + * hsh_free : Free a hash table */ -void hash_free(hash_t* ht); +void hsh_free(hsh_t* ht); /* - * hash_count: Number of values in hash table + * hsh_count: Number of values in hash table * - returns the number of entries in hash table */ -unsigned int hash_count(hash_t* ht); +unsigned int hsh_count(hsh_t* ht); /* - * hash_get: Retrieves a value from the hash table + * hsh_get: Retrieves a value from the hash table * - returns the value of the entry */ -void* hash_get(hash_t* ht, const void* key, size_t klen); +void* hsh_get(hsh_t* ht, const void* key, size_t klen); /* - * hash_set: Set a value in the hash table + * hsh_set: Set a value in the hash table * - returns 1 if the entry was added properly */ -int hash_set(hash_t* ht, const void* key, size_t klen, void* val); +int hsh_set(hsh_t* ht, const void* key, size_t klen, void* val); /* - * hash_rem: Remove a value from the hash table + * hsh_rem: Remove a value from the hash table * - returns the value of the removed entry */ -void* hash_rem(hash_t* ht, const void* key, size_t klen); +void* hsh_rem(hsh_t* ht, const void* key, size_t klen); /* - * hash_first: Start enumerating through the hash table + * hsh_first: Start enumerating through the hash table * - returns a hash iterator */ -hash_index_t* hash_first(hash_t* ht); +hsh_index_t* hsh_first(hsh_t* ht); /* - * hash_next: Enumerate through hash table + * hsh_next: Enumerate through hash table * - returns the hash iterator or null when no more entries */ -hash_index_t* hash_next(hash_index_t* hi); +hsh_index_t* hsh_next(hsh_index_t* hi); /* - * hash_this: While enumerating get current value + * hsh_this: While enumerating get current value * - returns the value that the iterator currently points to */ -void* hash_this(hash_index_t* hi, const void** key, size_t* klen); +void* hsh_this(hsh_index_t* hi, const void** key, size_t* klen); /* * This can be passed as 'klen' in any of the above functions to indicate * a string-valued key, and have hash compute the length automatically. */ -#define HASH_KEY_STRING (-1) +#define HSH_KEY_STRING (-1) #endif @@ -210,27 +210,27 @@ void* hash_this(hash_index_t* hi, const void** key, size_t* klen); * functions in addition to one of the above 'key' modes. */ -#ifdef HASH_TIMESTAMP +#ifdef HSH_TIMESTAMP /* - * hash_purge: Purge entries before a certain timestamp + * hsh_purge: Purge entries before a certain timestamp * - returns the number of entries purged */ -int hash_purge(hash_t* ht, time_t stamp); +int hsh_purge(hsh_t* ht, time_t stamp); /* - * hash_touch: Touch an entry to make it's timestamp current + * hsh_touch: Touch an entry to make it's timestamp current */ -#ifdef HASH_COPYKEYS - void hash_touch(hash_t* ht, const void* key); +#ifdef HSH_COPYKEYS + void hsh_touch(hsh_t* ht, const void* key); #else - void hash_touch(hash_t* ht, const void* key, size_t* klen); + void hsh_touch(hsh_t* ht, const void* key, size_t* klen); #endif /* - * hash_bump: Bumps the oldest entry out + * hsh_bump: Bumps the oldest entry out */ -int hash_bump(hash_t* ht); +int hsh_bump(hsh_t* ht); #endif @@ -243,34 +243,34 @@ int hash_bump(hash_t* ht); * well as to get callbacks when an item is discarded. */ -#ifdef HASH_CALLBACKS +#ifdef HSH_CALLBACKS -typedef void* (*hash_falloc)(void* arg, size_t len); -typedef void (*hash_ffree)(void* arg, void* ptr); +typedef void* (*hsh_falloc)(void* arg, size_t len); +typedef void (*hsh_ffree)(void* arg, void* ptr); -typedef struct hash_memory_calls +typedef struct hsh_memory_calls { - hash_falloc f_alloc; - hash_ffree f_free; + hsh_falloc f_alloc; + hsh_ffree f_free; void* arg; } -hash_memory_calls_t; +hsh_memory_calls_t; /* Set the global memory calls */ -void hash_set_memory_calls(hash_memory_calls_t* hmc); +void hsh_set_memory_calls(hsh_memory_calls_t* hmc); -typedef void (*hash_ffreeval)(void* arg, void* val); +typedef void (*hsh_ffreeval)(void* arg, void* val); -typedef struct hash_table_calls +typedef struct hsh_table_calls { - hash_ffreeval f_freeval; + hsh_ffreeval f_freeval; void* arg; } -hash_table_calls_t; +hsh_table_calls_t; /* Set the per table free value call */ -void hash_set_table_calls(hash_t* ht, hash_table_calls_t* htc); +void hsh_set_table_calls(hsh_t* ht, hsh_table_calls_t* htc); #endif @@ -281,4 +281,4 @@ void hash_set_table_calls(hash_t* ht, hash_table_calls_t* htc); } #endif -#endif /* __HASH_H__ */ +#endif /* __HSH_H__ */ diff --git a/common/sock_any.c b/common/sock_any.c index acac8ee..0018318 100644 --- a/common/sock_any.c +++ b/common/sock_any.c @@ -1,3 +1,40 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * + * CONTRIBUTORS + * Nate Nielsen + * + */ #include #include @@ -10,12 +47,15 @@ #include -int sock_any_pton(const char* addr, struct sockaddr_any* any, int defport) +#define LOCALHOST_ADDR 0x7F000001 + +int sock_any_pton(const char* addr, struct sockaddr_any* any, int opts) { size_t l; - char buf[256]; /* TODO: Use a constant */ + char buf[256]; char* t; char* t2; + int defport = (opts & 0xFFFF); memset(any, 0, sizeof(*any)); @@ -32,13 +72,35 @@ int sock_any_pton(const char* addr, struct sockaddr_any* any, int defport) if(l < PORT_MIN || l > PORT_MAX || addr[l] != 0) break; - port = strtol(t, &t2, 10); + port = strtol(addr, &t2, 10); if(*t2 || port <= 0 || port >= 65536) break; - any->s.in.sin_family = AF_INET; - any->s.in.sin_port = htons((unsigned short)(port <= 0 ? defport : port)); - any->s.in.sin_addr.s_addr = 0; + any->s.in.sin_port = htons(port); + + /* Fill in the type based on defaults */ +#ifdef HAVE_INET6 + if(opts & SANY_OPT_DEFINET6) + any->s.in.sin_family = AF_INET6; + else +#endif + any->s.in.sin_family = AF_INET; + + /* Fill in the address based on defaults */ + if(opts & SANY_OPT_DEFLOCAL) + { +#ifdef HAVE_INET6 + if(opts & SANY_OPT_DEFINET6) + memcpy(&(any->s.in.sin6_addr), &in6addr_loopback, sizeof(struct in6_addr)); + else +#endif + any->s.in.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + } + + /* + * Note the 'any' option is the default since we zero out + * the entire structure above. + */ any->namelen = sizeof(any->s.in); return AF_INET; @@ -237,9 +299,10 @@ int sock_any_pton(const char* addr, struct sockaddr_any* any, int defport) return -1; } -int sock_any_ntop(struct sockaddr_any* any, char* addr, size_t addrlen) +int sock_any_ntop(struct sockaddr_any* any, char* addr, size_t addrlen, int opts) { int len = 0; + int port = 0; switch(any->s.a.sa_family) { @@ -257,12 +320,14 @@ int sock_any_ntop(struct sockaddr_any* any, char* addr, size_t addrlen) case AF_INET: if(inet_ntop(any->s.a.sa_family, &(any->s.in.sin_addr), addr, addrlen) == NULL) return -1; + port = ntohs(any->s.in.sin_port); break; #ifdef HAVE_INET6 case AF_INET6: if(inet_ntop(any->s.a.sa_family, &(any->s.in6.sin6_addr), addr, addrlen) == NULL) return -1; + port = ntohs(any->s.in6.sin6_port); break; #endif @@ -271,5 +336,17 @@ int sock_any_ntop(struct sockaddr_any* any, char* addr, size_t addrlen) return -1; } + if(!(opts & SANY_OPT_NOPORT) && port != 0) + { + strncat(addr, ":", addrlen); + addr[addrlen - 1] = 0; + + len = strlen(addr); + addr += len; + addrlen -= len; + + snprintf(addr, addrlen, "%d", port); + } + return 0; } diff --git a/common/sock_any.h b/common/sock_any.h index 693bd2a..0b492b4 100644 --- a/common/sock_any.h +++ b/common/sock_any.h @@ -1,3 +1,40 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the + * above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * + * CONTRIBUTORS + * Nate Nielsen + * + */ #ifndef __SOCK_ANY_H__ #define __SOCK_ANY_H__ @@ -27,7 +64,25 @@ struct sockaddr_any #define SANY_LEN(any) ((any).namelen) #define SANY_TYPE(any) ((any).s.a.sa_family) -int sock_any_pton(const char* addr, struct sockaddr_any* any, int defport); -int sock_any_ntop(struct sockaddr_any* any, char* addr, size_t addrlen); +int sock_any_pton(const char* addr, struct sockaddr_any* any, int opts); + +/* The default port to fill in when no IP/IPv6 port specified */ +#define SANY_OPT_DEFPORT(p) (int)((p) & 0xFFFF) + +/* When only port specified default to IPANY */ +#define SANY_OPT_DEFANY 0x00000000 + +/* When only port specified default to LOCALHOST */ +#define SANY_OPT_DEFLOCAL 0x00100000 + +/* When only port specified default to IPv6 */ +#ifdef HAVE_INET6 +#define SANY_OPT_DEFINET6 0x00200000 +#endif + +int sock_any_ntop(struct sockaddr_any* any, char* addr, size_t addrlen, int opts); + +/* Don't print the port */ +#define SANY_OPT_NOPORT 0x01000000 #endif /* __SOCK_ANY_H__ */ diff --git a/configure.in b/configure.in index 50ef1fb..320fa2d 100644 --- a/configure.in +++ b/configure.in @@ -36,8 +36,8 @@ dnl Nate Nielsen dnl dnl Process this file with autoconf to produce a configure script. -AC_INIT(httpauth, 0.4, nielsen@memberwebs.com) -AM_INIT_AUTOMAKE(httpauth, 0.4) +AC_INIT(httpauth, 0.4.1, nielsen@memberwebs.com) +AM_INIT_AUTOMAKE(httpauth, 0.4.1) LDFLAGS="$LDFLAGS -L/usr/local/lib" CFLAGS="$CFLAGS -I/usr/local/include -g -O0" diff --git a/daemon/httpauthd.c b/daemon/httpauthd.c index e5b8dcb..c238a1a 100644 --- a/daemon/httpauthd.c +++ b/daemon/httpauthd.c @@ -340,9 +340,12 @@ int main(int argc, char* argv[]) continue; } + memset(&sany, 0, sizeof(sany)); + SANY_LEN(sany) = sizeof(sany); + /* Get the peer name */ if(getpeername(fd, &SANY_ADDR(sany), &SANY_LEN(sany)) == -1 || - sock_any_ntop(&sany, peername, MAXPATHLEN) == -1) + sock_any_ntop(&sany, peername, MAXPATHLEN, SANY_OPT_NOPORT) == -1) ha_messagex(LOG_WARNING, "%d: couldn't get peer address", fd); else ha_messagex(LOG_INFO, "%d: accepted connection from: %s", fd, peername); diff --git a/daemon/ldap.c b/daemon/ldap.c index 3befc4b..4398dc0 100644 --- a/daemon/ldap.c +++ b/daemon/ldap.c @@ -74,7 +74,7 @@ typedef struct ldap_context int ldap_timeout; /* Maximum amount of time to dedicate to an ldap query */ /* Context ----------------------------------------------------------- */ - hash_t* cache; /* Some cached records or basic */ + hsh_t* cache; /* Some cached records or basic */ LDAP** pool; /* Pool of available connections */ int pool_mark; /* Amount of connections allocated */ @@ -145,11 +145,11 @@ static digest_record_t* get_cached_digest(ldap_context_t* ctx, ha_context_t* c, ha_lock(NULL); - rec = (digest_record_t*)hash_get(ctx->cache, nonce); + rec = (digest_record_t*)hsh_get(ctx->cache, nonce); /* Just in case it's a basic :) */ if(rec && rec != BASIC_ESTABLISHED) - hash_rem(ctx->cache, nonce); + hsh_rem(ctx->cache, nonce); ha_unlock(NULL); @@ -165,7 +165,7 @@ static int have_cached_basic(ldap_context_t* ctx, unsigned char* key) ha_lock(NULL); - ret = (hash_get(ctx->cache, key) == BASIC_ESTABLISHED); + ret = (hsh_get(ctx->cache, key) == BASIC_ESTABLISHED); ha_unlock(NULL); @@ -187,10 +187,10 @@ static int save_cached_digest(ldap_context_t* ctx, ha_context_t* c, ha_lock(NULL); - while(hash_count(ctx->cache) >= c->cache_max) - hash_bump(ctx->cache); + while(hsh_count(ctx->cache) >= c->cache_max) + hsh_bump(ctx->cache); - r = hash_set(ctx->cache, rec->nonce, rec); + r = hsh_set(ctx->cache, rec->nonce, rec); ha_unlock(NULL); @@ -215,10 +215,10 @@ static int add_cached_basic(ldap_context_t* ctx, ha_context_t* c, ha_lock(NULL); - while(hash_count(ctx->cache) >= c->cache_max) - hash_bump(ctx->cache); + while(hsh_count(ctx->cache) >= c->cache_max) + hsh_bump(ctx->cache); - r = hash_set(ctx->cache, key, BASIC_ESTABLISHED); + r = hsh_set(ctx->cache, key, BASIC_ESTABLISHED); ha_unlock(NULL); @@ -633,6 +633,13 @@ static LDAP* get_ldap_connection(ldap_context_t* ctx) return ld; } +static void discard_ldap_connection(ldap_context_t* ctx, LDAP* ld) +{ + ldap_unbind_s(ld); + ctx->pool_mark--; + ha_messagex(LOG_DEBUG, "ldap: discarding connection (total %d)", ctx->pool_mark); +} + static void save_ldap_connection(ldap_context_t* ctx, LDAP* ld) { int i, e; @@ -670,13 +677,6 @@ static void save_ldap_connection(ldap_context_t* ctx, LDAP* ld) }; } -static discard_ldap_connection(ldap_context_t* ctx, LDAP* ld) -{ - ldap_unbind_s(ld); - ctx->pool_mark--; - ha_messagex(LOG_DEBUG, "ldap: discarding connection (total %d)", ctx->pool_mark); -} - static int retrieve_user_entry(ldap_context_t* ctx, const ha_request_t* req, LDAP* ld, const char* user, const char** dn, LDAPMessage** entry, LDAPMessage** result) @@ -1323,7 +1323,7 @@ int ldap_inithand(ha_context_t* context) else { ldap_context_t* ctx = (ldap_context_t*)(context->ctx_data); - hash_table_calls_t htc; + hsh_table_calls_t htc; ASSERT(ctx); @@ -1351,7 +1351,7 @@ int ldap_inithand(ha_context_t* context) } /* The cache for digest records and basic */ - if(!(ctx->cache = hash_create(MD5_LEN))) + if(!(ctx->cache = hsh_create(MD5_LEN))) { ha_messagex(LOG_CRIT, "out of memory"); return HA_CRITERROR; @@ -1359,7 +1359,7 @@ int ldap_inithand(ha_context_t* context) htc.f_freeval = free_hash_object; htc.arg = NULL; - hash_set_table_calls(ctx->cache, &htc); + hsh_set_table_calls(ctx->cache, &htc); ASSERT(!ctx->pool); ASSERT(ctx->ldap_max > 0); @@ -1398,7 +1398,7 @@ void ldap_destroy(ha_context_t* context) ASSERT(ctx); if(ctx->cache) - hash_free(ctx->cache); + hsh_free(ctx->cache); if(ctx->pool) { @@ -1430,7 +1430,7 @@ int ldap_process(const ha_request_t* req, ha_response_t* resp) ha_lock(NULL); /* Purge out stale connection stuff. */ - r = hash_purge(ctx->cache, t - req->context->cache_timeout); + r = hsh_purge(ctx->cache, t - req->context->cache_timeout); ha_unlock(NULL); diff --git a/daemon/ntlm.c b/daemon/ntlm.c index 37de9e8..031e19d 100644 --- a/daemon/ntlm.c +++ b/daemon/ntlm.c @@ -47,8 +47,8 @@ typedef struct ntlm_context int pending_timeout; /* Timeout for authentication (in seconds) */ /* Context ----------------------------------------------------------- */ - hash_t* pending; /* Pending connections */ - hash_t* established; /* Established connections */ + hsh_t* pending; /* Pending connections */ + hsh_t* established; /* Established connections */ } ntlm_context_t; @@ -135,7 +135,7 @@ static ntlm_connection_t* getpending(ntlm_context_t* ctx, const void* key) ha_lock(NULL); - ret = (ntlm_connection_t*)hash_rem(ctx->pending, key); + ret = (ntlm_connection_t*)hsh_rem(ctx->pending, key); ha_unlock(NULL); @@ -149,11 +149,11 @@ static int putpending(ntlm_context_t* ctx, const void* key, ntlm_connection_t* c ASSERT(ctx && key && conn); ASSERT(conn->handle); - if(!hash_get(ctx->pending, key)) + if(!hsh_get(ctx->pending, key)) { ha_lock(NULL); - if(!hash_set(ctx->pending, key, (void*)conn)) + if(!hsh_set(ctx->pending, key, (void*)conn)) { free_hash_object(NULL, conn); ha_messagex(LOG_ERR, "out of memory"); @@ -196,7 +196,7 @@ int ntlm_auth_basic(ntlm_context_t* ctx, char* key, const char* header, /* Check and see if this connection is in the cache */ ha_lock(NULL); - if(hash_get(ctx->established, basic.key) == NTLM_ESTABLISHED) + if(hsh_get(ctx->established, basic.key) == NTLM_ESTABLISHED) found = 1; ha_unlock(NULL); @@ -259,7 +259,7 @@ int ntlm_auth_basic(ntlm_context_t* ctx, char* key, const char* header, ha_lock(NULL); /* We put this connection into the successful connections */ - r = hash_set(ctx->established, basic.key, NTLM_ESTABLISHED); + r = hsh_set(ctx->established, basic.key, NTLM_ESTABLISHED); ha_unlock(NULL); @@ -371,8 +371,8 @@ int ntlm_auth_ntlm(ntlm_context_t* ctx, void* key, const char* header, { ha_lock(NULL); - if(hash_count(ctx->pending) >= ctx->pending_max) - hash_bump(ctx->pending); + if(hsh_count(ctx->pending) >= ctx->pending_max) + hsh_bump(ctx->pending); ha_unlock(NULL); } @@ -498,7 +498,7 @@ int ntlm_auth_ntlm(ntlm_context_t* ctx, void* key, const char* header, ha_lock(NULL); /* We put this connection into the successful connections */ - r = hash_set(ctx->established, key, NTLM_ESTABLISHED); + r = hsh_set(ctx->established, key, NTLM_ESTABLISHED); ha_unlock(NULL); @@ -581,7 +581,7 @@ int ntlm_init(ha_context_t* context) if(context) { ntlm_context_t* ctx = (ntlm_context_t*)(context->ctx_data); - hash_table_calls_t htc; + hsh_table_calls_t htc; ASSERT(ctx); @@ -605,8 +605,8 @@ int ntlm_init(ha_context_t* context) ASSERT(!ctx->established); /* Initialize our tables */ - if(!(ctx->pending = hash_create(NTLM_HASH_KEY_LEN)) || - !(ctx->established = hash_create(NTLM_HASH_KEY_LEN))) + if(!(ctx->pending = hsh_create(NTLM_HASH_KEY_LEN)) || + !(ctx->established = hsh_create(NTLM_HASH_KEY_LEN))) { ha_messagex(LOG_CRIT, "out of memory"); return HA_CRITERROR; @@ -614,7 +614,7 @@ int ntlm_init(ha_context_t* context) htc.f_freeval = free_hash_object; htc.arg = NULL; - hash_set_table_calls(ctx->pending, &htc); + hsh_set_table_calls(ctx->pending, &htc); ha_messagex(LOG_INFO, "ntlm: initialized handler"); } @@ -644,10 +644,10 @@ void ntlm_destroy(ha_context_t* context) ntlm_context_t* ctx = (ntlm_context_t*)(context->ctx_data); if(ctx->pending) - hash_free(ctx->pending); + hsh_free(ctx->pending); if(ctx->established) - hash_free(ctx->established); + hsh_free(ctx->established); ha_messagex(LOG_INFO, "ntlm: uninitialized handler"); } @@ -686,8 +686,8 @@ int ntlm_process(const ha_request_t* req, ha_response_t* resp) * authenticated connections which have expired as * well as half open connections which expire. */ - r = hash_purge(ctx->pending, t - ctx->pending_timeout); - r += hash_purge(ctx->established, t - req->context->cache_timeout); + r = hsh_purge(ctx->pending, t - ctx->pending_timeout); + r += hsh_purge(ctx->established, t - req->context->cache_timeout); ha_unlock(NULL); @@ -739,9 +739,9 @@ int ntlm_process(const ha_request_t* req, ha_response_t* resp) * allow connections to be re-authenticated. */ - if(hash_get(ctx->established, key) == NTLM_ESTABLISHED) + if(hsh_get(ctx->established, key) == NTLM_ESTABLISHED) { - hash_touch(ctx->established, key); + hsh_touch(ctx->established, key); resp->code = HA_SERVER_OK; } diff --git a/daemon/simple.c b/daemon/simple.c index 52d565d..ee4fafa 100644 --- a/daemon/simple.c +++ b/daemon/simple.c @@ -29,7 +29,7 @@ typedef struct simple_context const char* filename; /* The file name with the user names */ /* Context ----------------------------------------------------------- */ - hash_t* cache; /* Some cached records or basic */ + hsh_t* cache; /* Some cached records or basic */ } simple_context_t; @@ -56,11 +56,11 @@ static digest_record_t* get_cached_digest(simple_context_t* ctx, ha_context_t* c ha_lock(NULL); - rec = (digest_record_t*)hash_get(ctx->cache, nonce); + rec = (digest_record_t*)hsh_get(ctx->cache, nonce); /* Just in case it's a basic :) */ if(rec && rec != BASIC_ESTABLISHED) - hash_rem(ctx->cache, nonce); + hsh_rem(ctx->cache, nonce); ha_unlock(NULL); @@ -76,7 +76,7 @@ static int have_cached_basic(simple_context_t* ctx, unsigned char* key) ha_lock(NULL); - ret = (hash_get(ctx->cache, key) == BASIC_ESTABLISHED); + ret = (hsh_get(ctx->cache, key) == BASIC_ESTABLISHED); ha_unlock(NULL); @@ -98,10 +98,10 @@ static int save_cached_digest(simple_context_t* ctx, ha_context_t* c, ha_lock(NULL); - while(hash_count(ctx->cache) >= c->cache_max) - hash_bump(ctx->cache); + while(hsh_count(ctx->cache) >= c->cache_max) + hsh_bump(ctx->cache); - r = hash_set(ctx->cache, rec->nonce, rec); + r = hsh_set(ctx->cache, rec->nonce, rec); ha_unlock(NULL); @@ -127,10 +127,10 @@ static int add_cached_basic(simple_context_t* ctx, ha_context_t* c, ha_lock(NULL); - while(hash_count(ctx->cache) >= c->cache_max) - hash_bump(ctx->cache); + while(hsh_count(ctx->cache) >= c->cache_max) + hsh_bump(ctx->cache); - r = hash_set(ctx->cache, key, BASIC_ESTABLISHED); + r = hsh_set(ctx->cache, key, BASIC_ESTABLISHED); ha_unlock(NULL); @@ -611,7 +611,7 @@ int simple_init(ha_context_t* context) else { simple_context_t* ctx = (simple_context_t*)(context->ctx_data); - hash_table_calls_t htc; + hsh_table_calls_t htc; int fd; ASSERT(ctx); @@ -645,7 +645,7 @@ int simple_init(ha_context_t* context) ASSERT(!ctx->cache); /* The cache for digest records and basic */ - if(!(ctx->cache = hash_create(MD5_LEN))) + if(!(ctx->cache = hsh_create(MD5_LEN))) { ha_messagex(LOG_CRIT, "out of memory"); return HA_CRITERROR; @@ -653,7 +653,7 @@ int simple_init(ha_context_t* context) htc.f_freeval = free_hash_object; htc.arg = NULL; - hash_set_table_calls(ctx->cache, &htc); + hsh_set_table_calls(ctx->cache, &htc); ha_messagex(LOG_INFO, "simple: initialized handler"); } @@ -670,7 +670,7 @@ void simple_destroy(ha_context_t* context) simple_context_t* ctx = (simple_context_t*)(context->ctx_data); if(ctx->cache) - hash_free(ctx->cache); + hsh_free(ctx->cache); ha_messagex(LOG_INFO, "simple: uninitialized handler"); } @@ -692,7 +692,7 @@ int simple_process(const ha_request_t* req, ha_response_t* resp) ha_lock(NULL); /* Purge the cache */ - r = hash_purge(ctx->cache, time(NULL) - req->context->cache_timeout); + r = hsh_purge(ctx->cache, time(NULL) - req->context->cache_timeout); ha_unlock(NULL); -- cgit v1.2.3