From e593016a80ceee52b6e3244512ff4307f8c208fa Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 10 May 2006 17:31:32 +0000 Subject: Add NTLM support. --- apache1x/mod_httpauth.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'apache1x/mod_httpauth.c') diff --git a/apache1x/mod_httpauth.c b/apache1x/mod_httpauth.c index 2aa34b8..b399c5d 100644 --- a/apache1x/mod_httpauth.c +++ b/apache1x/mod_httpauth.c @@ -66,9 +66,11 @@ httpauth_context_t; #define AUTH_PREFIX_BASIC "Basic" #define AUTH_PREFIX_DIGEST "Digest" +#define AUTH_PREFIX_NTLM "NTLM" #define AUTH_TYPE_BASIC 1 << 1 #define AUTH_TYPE_DIGEST 1 << 2 +#define AUTH_TYPE_NTLM 1 << 3 #define AUTH_TYPE_ANY 0x0000FFFF #define HTTPAUTH_AUTHTYPE "HTTPAUTH" @@ -117,6 +119,8 @@ static const char* set_types(cmd_parms* cmd, void* config, const char* val) type = AUTH_TYPE_BASIC; else if(strcasecmp(val, AUTH_PREFIX_DIGEST) == 0) type = AUTH_TYPE_DIGEST; + else if(strcasecmp(val, AUTH_PREFIX_NTLM) == 0) + type = AUTH_TYPE_NTLM; else if(strcasecmp(val, "any")) type = AUTH_TYPE_ANY; else @@ -144,7 +148,7 @@ static const command_rec httpauth_cmds[] = { "HttpAuthHandler", set_handler, NULL, OR_AUTHCFG, TAKE1, "The handler that httpauthd should use to authenticate" }, { "HttpAuthTypes", set_types, NULL, OR_AUTHCFG, ITERATE, - "The types of authentiction allowed (Basic, Digest, ...)" }, + "The types of authentiction allowed (Basic, Digest, NTLM ...)" }, { "HttpAuthDigestDomain", set_domain, NULL, OR_AUTHCFG, RAW_ARGS, "The domain for which digest authentication is relevant" }, { NULL, NULL, NULL, 0, 0, NULL } @@ -412,6 +416,10 @@ int read_copy_headers(httpauth_context_t* ctx, int ccode, request_rec* r) !(ctx->types & AUTH_TYPE_DIGEST)) continue; + else if(strncasecmp(line, AUTH_PREFIX_NTLM, strlen(AUTH_PREFIX_NTLM)) == 0 && + !(ctx->types & AUTH_TYPE_NTLM)) + continue; + /* Only allow unknown if we don't have it */ else if(!(ctx->types & AUTH_TYPE_ANY)) continue; @@ -608,6 +616,11 @@ int write_request(httpauth_context_t* ctx, request_rec* r) const array_header* hdrs_arr; const table_entry* elts; + /* + * TODO: We need to use a valid connection id for + * NTLM connections to work properly. + */ + /* Send the request header to httpauthd */ t = ap_pstrcat(r->pool, "AUTH XXX ", r->method, " ", r->unparsed_uri, "\n", NULL); -- cgit v1.2.3