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 --- daemon/simple.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'daemon/simple.c') 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