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/ntlm.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'daemon/ntlm.c') 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; } -- cgit v1.2.3