summaryrefslogtreecommitdiff
path: root/apache1x/mod_httpauth.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-05-17 23:19:52 +0000
committerStef Walter <stef@memberwebs.com>2006-05-17 23:19:52 +0000
commitacbe1e8b817da2bb32d2db79a56748d829d84baa (patch)
tree44a247eb8a0fb820c9f7970a69421e839474f243 /apache1x/mod_httpauth.c
parent972952bb7b44e8c7c469acd34131232d370ded53 (diff)
0.5.1
- Fix problem with NTLM connection caching
Diffstat (limited to 'apache1x/mod_httpauth.c')
-rw-r--r--apache1x/mod_httpauth.c24
1 files changed, 23 insertions, 1 deletions
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;