From 0b7db8805d91eac81a4b526d3400a9d50bd5c7e1 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 19 Jun 2006 16:30:37 +0000 Subject: Fix NTLM problems with apache 2x module. --- apache2x/mod_httpauth.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'apache2x/mod_httpauth.c') diff --git a/apache2x/mod_httpauth.c b/apache2x/mod_httpauth.c index 9e8a95a..9d3854b 100644 --- a/apache2x/mod_httpauth.c +++ b/apache2x/mod_httpauth.c @@ -54,6 +54,12 @@ module AP_MODULE_DECLARE_DATA 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; @@ -614,6 +620,14 @@ finally: return ret; } +/* Make sure our connection identifier is unique */ +static apr_status_t connection_gone (void *data) +{ + conn_current = NULL; + conn_seen++; + return APR_SUCCESS; +} + int write_request(httpauth_context_t* ctx, request_rec* r) { char pidid[40]; @@ -623,9 +637,17 @@ int write_request(httpauth_context_t* ctx, request_rec* r) const apr_array_header_t* hdrs_arr; const apr_table_entry_t* elts; + /* When the connection goes away, call our handler */ + if(conn_current != r->connection) + { + conn_current = r->connection; + apr_pool_cleanup_register(r->connection->pool, r, + connection_gone, apr_pool_cleanup_null); + } + /* A unique per connection id */ - snprintf(connid, sizeof(connid), "0x%X-%X", - (unsigned int)r->connection, (unsigned int)r->connection->id); + snprintf(connid, sizeof(connid), "0x%X-%X-%X", + (unsigned int)r->connection, conn_seen, (unsigned int)r->connection->id); connid[sizeof(connid) - 1] = 0; snprintf(pidid, sizeof(pidid), "%d", (unsigned int)getpid()); pidid[sizeof(pidid) - 1] = 0; -- cgit v1.2.3