From acbe1e8b817da2bb32d2db79a56748d829d84baa Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 17 May 2006 23:19:52 +0000 Subject: 0.5.1 - Fix problem with NTLM connection caching --- apache1x/mod_httpauth.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'apache1x/mod_httpauth.c') diff --git a/apache1x/mod_httpauth.c b/apache1x/mod_httpauth.c index 4443c81..4cb3e3f 100644 --- a/apache1x/mod_httpauth.c +++ b/apache1x/mod_httpauth.c @@ -51,6 +51,12 @@ module MODULE_VAR_EXPORT httpauth_module; +/* Keep track of a unique identifier */ +static void* conn_current = NULL; + +/* And increment this when it goes out of scope */ +static unsigned int conn_seen = 0; + typedef struct httpauth_context { const char* socketname; @@ -609,6 +615,13 @@ finally: return ret; } +/* Make sure our connection identifier is unique */ +static void connection_gone (void *data) +{ + conn_current = NULL; + conn_seen++; +} + int write_request(httpauth_context_t* ctx, request_rec* r) { char pidid[40]; @@ -618,8 +631,17 @@ int write_request(httpauth_context_t* ctx, request_rec* r) const array_header* hdrs_arr; const table_entry* elts; + /* When the connection goes away, call our handler */ + if(conn_current != r->connection) + { + conn_current = r->connection; + ap_register_cleanup(r->connection->pool, r, + connection_gone, ap_null_cleanup); + } + /* A unique per connection id */ - snprintf(connid, sizeof(connid), "0x%X", (unsigned int)r->connection); + snprintf(connid, sizeof(connid), "0x%X-%X", + (unsigned int)r->connection, conn_seen); connid[sizeof(connid) - 1] = 0; snprintf(pidid, sizeof(pidid), "%d", (unsigned int)getpid()); pidid[sizeof(pidid) - 1] = 0; -- cgit v1.2.3