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. --- ChangeLog | 3 +++ apache2x/mod_httpauth.c | 26 ++++++++++++++++++++++++-- configure.in | 4 ++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a96a9b1..e1ca284 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +0.5.3 + - Guarantee unique connection identfier for NTLM when using apache2 + 0.5.2 - Better messages when keepalives are not used with NTLM - Fix problems in java servlet authenticator [Ross Elliot] 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; diff --git a/configure.in b/configure.in index c3fa502..784e34c 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.5.2, nielsen@memberwebs.com) -AM_INIT_AUTOMAKE(httpauth, 0.5.2) +AC_INIT(httpauth, 0.5.2.90, nielsen@memberwebs.com) +AM_INIT_AUTOMAKE(httpauth, 0.5.2.90) LDFLAGS="$LDFLAGS -L/usr/local/lib" CFLAGS="$CFLAGS -I/usr/local/include -g -O0" -- cgit v1.2.3