From: Amos Jeffries Date: Mon, 28 Mar 2011 04:02:03 +0000 (-0600) Subject: SourceLayout: build auth sub-libraries in abstraction X-Git-Tag: take06~27^2~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=616cfc4cbf306c96e0a68953dc0943dafcd1ef56;p=thirdparty%2Fsquid.git SourceLayout: build auth sub-libraries in abstraction This changes the building process for auth sub-libraries: libbasic.la, libdigest.la, libnegotiate.la, libntlm.la making them build from their own Makefiles. That allows each sub-dir to be automatically included (or not) to the main auth/libauth.la library. TODO: (no necessarily in this order) * split out the classes into their own compile units (files) * add namespace Auth and per-protocol child areas * de-duplicate the repetitive code back into the parent classes --- diff --git a/configure.ac b/configure.ac index 81f6418644..a612b7a83e 100644 --- a/configure.ac +++ b/configure.ac @@ -1758,7 +1758,7 @@ dnl This list will not be needed when each auth library has its own Makefile dnl this is to be placed AFTER each auth module's handler AUTH_LIBS_TO_BUILD= for module in $AUTH_MODULES; do - AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD lib${module}.la" + AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la" done AC_SUBST(AUTH_MODULES) AC_SUBST(AUTH_LIBS_TO_BUILD) @@ -3372,6 +3372,10 @@ AC_CONFIG_FILES([\ src/fs/Makefile \ src/repl/Makefile \ src/auth/Makefile \ + src/auth/basic/Makefile \ + src/auth/digest/Makefile \ + src/auth/negotiate/Makefile \ + src/auth/ntlm/Makefile \ src/adaptation/Makefile \ src/adaptation/icap/Makefile \ src/adaptation/ecap/Makefile \ diff --git a/src/AuthReg.cc b/src/AuthReg.cc index 079d81594e..19c95937e3 100644 --- a/src/AuthReg.cc +++ b/src/AuthReg.cc @@ -6,16 +6,16 @@ #include "protos.h" #if HAVE_AUTH_MODULE_BASIC -#include "auth/basic/basicScheme.h" +#include "auth/basic/Scheme.h" #endif #if HAVE_AUTH_MODULE_DIGEST -#include "auth/digest/digestScheme.h" +#include "auth/digest/Scheme.h" #endif #if HAVE_AUTH_MODULE_NEGOTIATE -#include "auth/negotiate/negotiateScheme.h" +#include "auth/negotiate/Scheme.h" #endif #if HAVE_AUTH_MODULE_NTLM -#include "auth/ntlm/ntlmScheme.h" +#include "auth/ntlm/Scheme.h" #endif /** diff --git a/src/auth/Makefile.am b/src/auth/Makefile.am index f6faae982e..69918ee16b 100644 --- a/src/auth/Makefile.am +++ b/src/auth/Makefile.am @@ -1,15 +1,17 @@ include $(top_srcdir)/src/Common.am +include $(top_srcdir)/src/TestHeaders.am -## we need our local files too (but avoid -I. at all costs) -INCLUDES += -I$(srcdir) +SUBDIRS = $(AUTH_MODULES) +DIST_SUBDIRS = basic digest negotiate ntlm -noinst_LTLIBRARIES = libauth.la libacls.la $(AUTH_LIBS_TO_BUILD) -EXTRA_LTLIBRARIES = libbasic.la libdigest.la libntlm.la libnegotiate.la +noinst_LTLIBRARIES = libauth.la libacls.la +## not needed? $(AUTH_LIBS_TO_BUILD) +## EXTRA_LTLIBRARIES = libdigest.la libntlm.la libnegotiate.la ## authentication framework; this library is always built libauth_la_SOURCES = \ - AuthType.h \ - AuthType.cc \ + Type.h \ + Type.cc \ Config.cc \ Config.h \ Gadgets.cc \ @@ -38,50 +40,7 @@ libacls_la_SOURCES = \ AclProxyAuth.h \ AuthAclState.h -libbasic_la_SOURCES = \ - basic/basicScheme.cc \ - basic/basicScheme.h \ - basic/auth_basic.cc \ - basic/auth_basic.h \ - basic/basicUserRequest.cc \ - basic/basicUserRequest.h +Type.cc: Type.h $(top_srcdir)/src/mk-string-arrays.awk + $(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk < $(srcdir)/Type.h > $@ || (rm -f $@ ; exit 1) -libdigest_la_SOURCES = \ - digest/digestScheme.cc \ - digest/digestScheme.h \ - digest/auth_digest.cc \ - digest/auth_digest.h \ - digest/digestUserRequest.cc \ - digest/digestUserRequest.h - -libntlm_la_SOURCES = \ - ntlm/ntlmScheme.cc \ - ntlm/ntlmScheme.h \ - ntlm/auth_ntlm.cc \ - ntlm/auth_ntlm.h \ - ntlm/ntlmUserRequest.cc \ - ntlm/ntlmUserRequest.h - -libnegotiate_la_SOURCES = \ - negotiate/negotiateScheme.cc \ - negotiate/negotiateScheme.h \ - negotiate/auth_negotiate.cc \ - negotiate/auth_negotiate.h \ - negotiate/negotiateUserRequest.cc \ - negotiate/negotiateUserRequest.h - -AuthType.cc: AuthType.h $(top_srcdir)/src/mk-string-arrays.awk - $(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk < $(srcdir)/AuthType.h > $@ || (rm -f $@ ; exit 1) - -CLEANFILES += AuthType.cc - - -TESTS += testHeaders - -## Special Universal .h dependency test script -## aborts if error encountered -testHeaders: $(top_srcdir)/src/auth/*.h $(top_srcdir)/src/auth/basic/*.h $(top_srcdir)/src/auth/digest/*.h $(top_srcdir)/src/auth/ntlm/*.h $(top_srcdir)/src/auth/negotiate/*.h - $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1 - -CLEANFILES += testHeaders -.PHONY: testHeaders +CLEANFILES += Type.cc diff --git a/src/auth/AuthType.h b/src/auth/Type.h similarity index 79% rename from src/auth/AuthType.h rename to src/auth/Type.h index 783b4b5b9b..3f26b8c301 100644 --- a/src/auth/AuthType.h +++ b/src/auth/Type.h @@ -3,6 +3,8 @@ #if USE_AUTH +namespace Auth { + typedef enum { AUTH_UNKNOWN, /* default */ AUTH_BASIC, @@ -10,9 +12,11 @@ typedef enum { AUTH_DIGEST, AUTH_NEGOTIATE, AUTH_BROKEN /* known type, but broken data */ -} AuthType; +} Type; + +extern const char *Type_str[]; -extern const char *AuthType_str[]; +}; // namespace Auth #endif /* USE_AUTH */ #endif diff --git a/src/auth/User.cc b/src/auth/User.cc index 0e6e4effc5..54e2446b5d 100644 --- a/src/auth/User.cc +++ b/src/auth/User.cc @@ -57,7 +57,7 @@ const char *CredentialsState_str[] = { "Unchecked", "Ok", "Pending", "Handshake" AuthUser::AuthUser(AuthConfig *aConfig) : - auth_type(AUTH_UNKNOWN), + auth_type(Auth::AUTH_UNKNOWN), config(aConfig), ipcount(0), expiretime(0), @@ -174,7 +174,7 @@ AuthUser::~AuthUser() xfree((char*)username_); /* prevent accidental reuse */ - auth_type = AUTH_UNKNOWN; + auth_type = Auth::AUTH_UNKNOWN; } void @@ -385,7 +385,7 @@ AuthUser::UsernameCacheStats(StoreEntry *output) AuthUser::Pointer auth_user = usernamehash->user(); storeAppendPrintf(output, "%-15s %-9s %-9d %-9d %s\n", - AuthType_str[auth_user->auth_type], + Auth::Type_str[auth_user->auth_type], CredentialsState_str[auth_user->credentials()], auth_user->ttl(), static_cast(auth_user->expiretime - squid_curtime + Config.authenticateTTL), diff --git a/src/auth/User.h b/src/auth/User.h index cf1ee5d66e..81c0f73684 100644 --- a/src/auth/User.h +++ b/src/auth/User.h @@ -36,7 +36,7 @@ #if USE_AUTH -#include "auth/AuthType.h" +#include "auth/Type.h" #include "dlink.h" #include "ip/Address.h" #include "RefCount.h" @@ -63,7 +63,7 @@ public: * Aim to remove shortly */ /** \deprecated this determines what scheme owns the user data. */ - AuthType auth_type; + Auth::Type auth_type; /** the config for this user */ AuthConfig *config; /** we may have many proxy-authenticate strings that decode to the same user */ diff --git a/src/auth/UserRequest.cc b/src/auth/UserRequest.cc index 0e19f908b5..d0d65af890 100644 --- a/src/auth/UserRequest.cc +++ b/src/auth/UserRequest.cc @@ -84,12 +84,12 @@ AuthUserRequest::valid() const return false; } - if (user()->auth_type == AUTH_UNKNOWN) { + if (user()->auth_type == Auth::AUTH_UNKNOWN) { debugs(29, 4, HERE << "AuthUser '" << user() << "' uses unknown scheme."); return false; } - if (user()->auth_type == AUTH_BROKEN) { + if (user()->auth_type == Auth::AUTH_BROKEN) { debugs(29, 4, HERE << "AuthUser '" << user() << "' is broken for it's scheme."); return false; } diff --git a/src/auth/basic/Makefile.am b/src/auth/basic/Makefile.am new file mode 100644 index 0000000000..40b811fb5b --- /dev/null +++ b/src/auth/basic/Makefile.am @@ -0,0 +1,12 @@ +include $(top_srcdir)/src/Common.am +include $(top_srcdir)/src/TestHeaders.am + +noinst_LTLIBRARIES = libbasic.la + +libbasic_la_SOURCES = \ + Scheme.cc \ + Scheme.h \ + auth_basic.cc \ + auth_basic.h \ + UserRequest.cc \ + UserRequest.h diff --git a/src/auth/basic/basicScheme.cc b/src/auth/basic/Scheme.cc similarity index 98% rename from src/auth/basic/basicScheme.cc rename to src/auth/basic/Scheme.cc index f818e65919..ba93a05f81 100644 --- a/src/auth/basic/basicScheme.cc +++ b/src/auth/basic/Scheme.cc @@ -31,7 +31,7 @@ */ #include "config.h" -#include "auth/basic/basicScheme.h" +#include "auth/basic/Scheme.h" #include "helper.h" /* for AuthConfig */ diff --git a/src/auth/basic/basicScheme.h b/src/auth/basic/Scheme.h similarity index 98% rename from src/auth/basic/basicScheme.h rename to src/auth/basic/Scheme.h index 4bb12e3d77..587e49c594 100644 --- a/src/auth/basic/basicScheme.h +++ b/src/auth/basic/Scheme.h @@ -56,7 +56,6 @@ public: private: static AuthScheme::Pointer _instance; -// AuthBasicConfig basicConfig; }; #endif /* SQUID_BASICSCHEME_H */ diff --git a/src/auth/basic/basicUserRequest.cc b/src/auth/basic/UserRequest.cc similarity index 95% rename from src/auth/basic/basicUserRequest.cc rename to src/auth/basic/UserRequest.cc index aebe0f0ddb..622db5aa4c 100644 --- a/src/auth/basic/basicUserRequest.cc +++ b/src/auth/basic/UserRequest.cc @@ -1,8 +1,7 @@ #include "config.h" -#include "auth/basic/basicUserRequest.h" -#include "SquidTime.h" - #include "auth/basic/auth_basic.h" +#include "auth/basic/UserRequest.h" +#include "SquidTime.h" int AuthBasicUserRequest::authenticated() const @@ -46,7 +45,7 @@ int AuthBasicUserRequest::module_direction() { /* null auth_user is checked for by authenticateDirection */ - if (user()->auth_type != AUTH_BASIC) + if (user()->auth_type != Auth::AUTH_BASIC) return -2; switch (user()->credentials()) { @@ -72,7 +71,7 @@ AuthBasicUserRequest::module_direction() void AuthBasicUserRequest::module_start(RH * handler, void *data) { - assert(user()->auth_type == AUTH_BASIC); + assert(user()->auth_type == Auth::AUTH_BASIC); BasicUser *basic_auth = dynamic_cast(user().getRaw()); assert(basic_auth != NULL); debugs(29, 9, HERE << "'" << basic_auth->username() << ":" << basic_auth->passwd << "'"); diff --git a/src/auth/basic/basicUserRequest.h b/src/auth/basic/UserRequest.h similarity index 100% rename from src/auth/basic/basicUserRequest.h rename to src/auth/basic/UserRequest.h diff --git a/src/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index c854f98281..299a22b8ad 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -39,8 +39,8 @@ #include "squid.h" #include "auth/basic/auth_basic.h" -#include "auth/basic/basicScheme.h" -#include "auth/basic/basicUserRequest.h" +#include "auth/basic/Scheme.h" +#include "auth/basic/UserRequest.h" #include "auth/Gadgets.h" #include "auth/State.h" #include "charset.h" @@ -180,7 +180,7 @@ authenticateBasicHandleReply(void *data, char *reply) } assert(r->auth_user_request != NULL); - assert(r->auth_user_request->user()->auth_type == AUTH_BASIC); + assert(r->auth_user_request->user()->auth_type == Auth::AUTH_BASIC); /* this is okay since we only play with the BasicUser child fields below * and dont pass the pointer itself anywhere */ @@ -289,7 +289,7 @@ authBasicAuthUserFindUsername(const char *username) if (username && (usernamehash = static_cast(hash_lookup(proxy_auth_username_cache, username)))) { while (usernamehash) { - if ((usernamehash->user()->auth_type == AUTH_BASIC) && + if ((usernamehash->user()->auth_type == Auth::AUTH_BASIC) && !strcmp(username, (char const *)usernamehash->key)) return usernamehash->user(); @@ -426,7 +426,7 @@ AuthBasicConfig::decode(char const *proxy_auth) xfree(cleartext); if (!local_basic->valid()) { - lb->auth_type = AUTH_BROKEN; + lb->auth_type = Auth::AUTH_BROKEN; auth_user_request->user(lb); return auth_user_request; } @@ -439,7 +439,7 @@ AuthBasicConfig::decode(char const *proxy_auth) /* save the credentials */ debugs(29, 9, HERE << "Creating new user '" << lb->username() << "'"); /* set the auth_user type */ - lb->auth_type = AUTH_BASIC; + lb->auth_type = Auth::AUTH_BASIC; /* current time for timeouts */ lb->expiretime = current_time.tv_sec; diff --git a/src/auth/digest/Makefile.am b/src/auth/digest/Makefile.am new file mode 100644 index 0000000000..7a946dea08 --- /dev/null +++ b/src/auth/digest/Makefile.am @@ -0,0 +1,12 @@ +include $(top_srcdir)/src/Common.am +include $(top_srcdir)/src/TestHeaders.am + +noinst_LTLIBRARIES = libdigest.la + +libdigest_la_SOURCES = \ + Scheme.cc \ + Scheme.h \ + auth_digest.cc \ + auth_digest.h \ + UserRequest.cc \ + UserRequest.h diff --git a/src/auth/digest/digestScheme.cc b/src/auth/digest/Scheme.cc similarity index 98% rename from src/auth/digest/digestScheme.cc rename to src/auth/digest/Scheme.cc index f823107baf..129335d55e 100644 --- a/src/auth/digest/digestScheme.cc +++ b/src/auth/digest/Scheme.cc @@ -31,7 +31,7 @@ */ #include "config.h" -#include "auth/digest/digestScheme.h" +#include "auth/digest/Scheme.h" #include "helper.h" AuthScheme::Pointer diff --git a/src/auth/digest/digestScheme.h b/src/auth/digest/Scheme.h similarity index 100% rename from src/auth/digest/digestScheme.h rename to src/auth/digest/Scheme.h diff --git a/src/auth/digest/digestUserRequest.cc b/src/auth/digest/UserRequest.cc similarity index 98% rename from src/auth/digest/digestUserRequest.cc rename to src/auth/digest/UserRequest.cc index 2e2620dbd9..63b0b84c1f 100644 --- a/src/auth/digest/digestUserRequest.cc +++ b/src/auth/digest/UserRequest.cc @@ -1,6 +1,6 @@ #include "config.h" #include "auth/digest/auth_digest.h" -#include "auth/digest/digestUserRequest.h" +#include "auth/digest/UserRequest.h" #include "auth/State.h" #include "charset.h" #include "HttpReply.h" @@ -168,7 +168,7 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, int AuthDigestUserRequest::module_direction() { - if (user()->auth_type != AUTH_DIGEST) + if (user()->auth_type != Auth::AUTH_DIGEST) return -2; switch (user()->credentials()) { @@ -251,7 +251,7 @@ AuthDigestUserRequest::module_start(RH * handler, void *data) authenticateStateData *r = NULL; char buf[8192]; - assert(user() != NULL && user()->auth_type == AUTH_DIGEST); + assert(user() != NULL && user()->auth_type == Auth::AUTH_DIGEST); debugs(29, 9, "authenticateStart: '\"" << user()->username() << "\":\"" << realm << "\"'"); if (static_cast(AuthConfig::Find("digest"))->authenticateProgram == NULL) { diff --git a/src/auth/digest/digestUserRequest.h b/src/auth/digest/UserRequest.h similarity index 100% rename from src/auth/digest/digestUserRequest.h rename to src/auth/digest/UserRequest.h diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index bdcef1cc97..05417f3b7b 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -40,6 +40,8 @@ #include "squid.h" #include "rfc2617.h" #include "auth/digest/auth_digest.h" +#include "auth/digest/Scheme.h" +#include "auth/digest/UserRequest.h" #include "auth/Gadgets.h" #include "base64.h" #include "event.h" @@ -49,9 +51,6 @@ #include "HttpReply.h" #include "wordlist.h" #include "SquidTime.h" -/* TODO don't include this */ -#include "auth/digest/digestScheme.h" -#include "auth/digest/digestUserRequest.h" /* Digest Scheme */ @@ -488,10 +487,10 @@ authDigestUserFindUsername(const char *username) debugs(29, 9, HERE << "Looking for user '" << username << "'"); if (username && (usernamehash = static_cast < auth_user_hash_pointer * >(hash_lookup(proxy_auth_username_cache, username)))) { - while ((usernamehash->user()->auth_type != AUTH_DIGEST) && (usernamehash->next)) + while ((usernamehash->user()->auth_type != Auth::AUTH_DIGEST) && (usernamehash->next)) usernamehash = static_cast(usernamehash->next); - if (usernamehash->user()->auth_type == AUTH_DIGEST) { + if (usernamehash->user()->auth_type == Auth::AUTH_DIGEST) { return usernamehash->user(); } } @@ -837,7 +836,7 @@ authDigestLogUsername(char *username, AuthUserRequest::Pointer auth_user_request /* save the credentials */ digest_user->username(username); /* set the auth_user type */ - digest_user->auth_type = AUTH_BROKEN; + digest_user->auth_type = Auth::AUTH_BROKEN; /* link the request to the user */ auth_user_request->user(digest_user); return auth_user_request; @@ -1100,7 +1099,7 @@ AuthDigestConfig::decode(char const *proxy_auth) /* save the username */ digest_user->username(username); /* set the user type */ - digest_user->auth_type = AUTH_DIGEST; + digest_user->auth_type = Auth::AUTH_DIGEST; /* this auth_user struct is the one to get added to the * username cache */ /* store user in hash's */ diff --git a/src/auth/negotiate/Makefile.am b/src/auth/negotiate/Makefile.am new file mode 100644 index 0000000000..f1b8aaceef --- /dev/null +++ b/src/auth/negotiate/Makefile.am @@ -0,0 +1,12 @@ +include $(top_srcdir)/src/Common.am +include $(top_srcdir)/src/TestHeaders.am + +noinst_LTLIBRARIES = libnegotiate.la + +libnegotiate_la_SOURCES = \ + Scheme.cc \ + Scheme.h \ + auth_negotiate.cc \ + auth_negotiate.h \ + UserRequest.cc \ + UserRequest.h diff --git a/src/auth/negotiate/negotiateScheme.cc b/src/auth/negotiate/Scheme.cc similarity index 98% rename from src/auth/negotiate/negotiateScheme.cc rename to src/auth/negotiate/Scheme.cc index 411415a2fe..95c02bca78 100644 --- a/src/auth/negotiate/negotiateScheme.cc +++ b/src/auth/negotiate/Scheme.cc @@ -31,7 +31,7 @@ */ #include "config.h" -#include "auth/negotiate/negotiateScheme.h" +#include "auth/negotiate/Scheme.h" #include "helper.h" AuthScheme::Pointer diff --git a/src/auth/negotiate/negotiateScheme.h b/src/auth/negotiate/Scheme.h similarity index 100% rename from src/auth/negotiate/negotiateScheme.h rename to src/auth/negotiate/Scheme.h diff --git a/src/auth/negotiate/negotiateUserRequest.cc b/src/auth/negotiate/UserRequest.cc similarity index 97% rename from src/auth/negotiate/negotiateUserRequest.cc rename to src/auth/negotiate/UserRequest.cc index 477e2fa20f..b6df1b6cdd 100644 --- a/src/auth/negotiate/negotiateUserRequest.cc +++ b/src/auth/negotiate/UserRequest.cc @@ -1,6 +1,6 @@ #include "config.h" #include "auth/negotiate/auth_negotiate.h" -#include "auth/negotiate/negotiateUserRequest.h" +#include "auth/negotiate/UserRequest.h" #include "auth/User.h" #include "helper.h" #include "HttpReply.h" @@ -66,7 +66,7 @@ AuthNegotiateUserRequest::module_direction() if (waiting || client_blob) return -1; /* need helper response to continue */ - if (user()->auth_type != AUTH_NEGOTIATE) + if (user()->auth_type != Auth::AUTH_NEGOTIATE) return -2; switch (user()->credentials()) { @@ -117,7 +117,7 @@ AuthNegotiateUserRequest::module_start(RH * handler, void *data) assert(handler); assert(user() != NULL); - assert(user()->auth_type == AUTH_NEGOTIATE); + assert(user()->auth_type == Auth::AUTH_NEGOTIATE); debugs(29, 8, HERE << "auth state is '" << user()->credentials() << "'"); @@ -295,7 +295,7 @@ AuthNegotiateUserRequest::HandleReply(void *data, void *lastserver, char *reply) safe_free(negotiate_request->client_blob); assert(auth_user_request->user() != NULL); - assert(auth_user_request->user()->auth_type == AUTH_NEGOTIATE); + assert(auth_user_request->user()->auth_type == Auth::AUTH_NEGOTIATE); if (negotiate_request->authserver == NULL) negotiate_request->authserver = static_cast(lastserver); @@ -347,7 +347,8 @@ AuthNegotiateUserRequest::HandleReply(void *data, void *lastserver, char *reply) * string */ AuthUserHashPointer *usernamehash = static_cast(hash_lookup(proxy_auth_username_cache, auth_user_request->user()->username())); AuthUser::Pointer local_auth_user = negotiate_request->user(); - while (usernamehash && (usernamehash->user()->auth_type != AUTH_NEGOTIATE || strcmp(usernamehash->user()->username(), auth_user_request->user()->username()) != 0)) + while (usernamehash && (usernamehash->user()->auth_type != Auth::AUTH_NEGOTIATE || + strcmp(usernamehash->user()->username(), auth_user_request->user()->username()) != 0)) usernamehash = static_cast(usernamehash->next); if (usernamehash) { /* we can't seamlessly recheck the username due to the diff --git a/src/auth/negotiate/negotiateUserRequest.h b/src/auth/negotiate/UserRequest.h similarity index 100% rename from src/auth/negotiate/negotiateUserRequest.h rename to src/auth/negotiate/UserRequest.h diff --git a/src/auth/negotiate/auth_negotiate.cc b/src/auth/negotiate/auth_negotiate.cc index 7b1e3e96c5..faf9401e37 100644 --- a/src/auth/negotiate/auth_negotiate.cc +++ b/src/auth/negotiate/auth_negotiate.cc @@ -47,9 +47,8 @@ #include "HttpReply.h" #include "HttpRequest.h" #include "SquidTime.h" -/** \todo remove this include */ -#include "auth/negotiate/negotiateScheme.h" -#include "auth/negotiate/negotiateUserRequest.h" +#include "auth/negotiate/Scheme.h" +#include "auth/negotiate/UserRequest.h" #include "wordlist.h" /** @@ -313,7 +312,7 @@ AuthNegotiateConfig::decode(char const *proxy_auth) assert(auth_user_request->user() == NULL); auth_user_request->user(newUser); - auth_user_request->user()->auth_type = AUTH_NEGOTIATE; + auth_user_request->user()->auth_type = Auth::AUTH_NEGOTIATE; /* all we have to do is identify that it's Negotiate - the helper does the rest */ debugs(29, 9, "AuthNegotiateConfig::decode: Negotiate authentication"); diff --git a/src/auth/ntlm/Makefile.am b/src/auth/ntlm/Makefile.am new file mode 100644 index 0000000000..7596816994 --- /dev/null +++ b/src/auth/ntlm/Makefile.am @@ -0,0 +1,12 @@ +include $(top_srcdir)/src/Common.am +include $(top_srcdir)/src/TestHeaders.am + +noinst_LTLIBRARIES = libntlm.la + +libntlm_la_SOURCES = \ + Scheme.cc \ + Scheme.h \ + auth_ntlm.cc \ + auth_ntlm.h \ + UserRequest.cc \ + UserRequest.h diff --git a/src/auth/ntlm/ntlmScheme.cc b/src/auth/ntlm/Scheme.cc similarity index 98% rename from src/auth/ntlm/ntlmScheme.cc rename to src/auth/ntlm/Scheme.cc index e6dee80e2c..bf727d8797 100644 --- a/src/auth/ntlm/ntlmScheme.cc +++ b/src/auth/ntlm/Scheme.cc @@ -32,7 +32,7 @@ #include "config.h" #include "auth/ntlm/auth_ntlm.h" -#include "auth/ntlm/ntlmScheme.h" +#include "auth/ntlm/Scheme.h" #include "helper.h" AuthScheme::Pointer diff --git a/src/auth/ntlm/ntlmScheme.h b/src/auth/ntlm/Scheme.h similarity index 100% rename from src/auth/ntlm/ntlmScheme.h rename to src/auth/ntlm/Scheme.h diff --git a/src/auth/ntlm/ntlmUserRequest.cc b/src/auth/ntlm/UserRequest.cc similarity index 97% rename from src/auth/ntlm/ntlmUserRequest.cc rename to src/auth/ntlm/UserRequest.cc index cce95b23ac..6aa7bd8d25 100644 --- a/src/auth/ntlm/ntlmUserRequest.cc +++ b/src/auth/ntlm/UserRequest.cc @@ -1,6 +1,6 @@ #include "config.h" -#include "auth/ntlm/ntlmUserRequest.h" #include "auth/ntlm/auth_ntlm.h" +#include "auth/ntlm/UserRequest.h" #include "auth/State.h" #include "cbdata.h" #include "HttpRequest.h" @@ -46,7 +46,7 @@ AuthNTLMUserRequest::module_direction() if (waiting || client_blob) return -1; /* need helper response to continue */ - if (user()->auth_type != AUTH_NTLM) + if (user()->auth_type != Auth::AUTH_NTLM) return -2; switch (user()->credentials()) { @@ -266,7 +266,7 @@ AuthNTLMUserRequest::HandleReply(void *data, void *lastserver, char *reply) assert(ntlm_request != NULL); assert(ntlm_request->waiting); assert(ntlm_request->user() != NULL); - assert(ntlm_request->user()->auth_type == AUTH_NTLM); + assert(ntlm_request->user()->auth_type == Auth::AUTH_NTLM); ntlm_request->waiting = 0; safe_free(ntlm_request->client_blob); @@ -307,7 +307,8 @@ AuthNTLMUserRequest::HandleReply(void *data, void *lastserver, char *reply) * string */ auth_user_hash_pointer *usernamehash = static_cast(hash_lookup(proxy_auth_username_cache, auth_user_request->user()->username())); AuthUser::Pointer local_auth_user = ntlm_request->user(); - while (usernamehash && (usernamehash->user()->auth_type != AUTH_NTLM || strcmp(usernamehash->user()->username(), auth_user_request->user()->username()) != 0)) + while (usernamehash && (usernamehash->user()->auth_type != Auth::AUTH_NTLM || + strcmp(usernamehash->user()->username(), auth_user_request->user()->username()) != 0)) usernamehash = static_cast(usernamehash->next); if (usernamehash) { /* we can't seamlessly recheck the username due to the diff --git a/src/auth/ntlm/ntlmUserRequest.h b/src/auth/ntlm/UserRequest.h similarity index 100% rename from src/auth/ntlm/ntlmUserRequest.h rename to src/auth/ntlm/UserRequest.h diff --git a/src/auth/ntlm/auth_ntlm.cc b/src/auth/ntlm/auth_ntlm.cc index de52cb58e3..a38d524361 100644 --- a/src/auth/ntlm/auth_ntlm.cc +++ b/src/auth/ntlm/auth_ntlm.cc @@ -40,8 +40,8 @@ #include "squid.h" #include "auth/Gadgets.h" #include "auth/ntlm/auth_ntlm.h" -#include "auth/ntlm/ntlmScheme.h" -#include "auth/ntlm/ntlmUserRequest.h" +#include "auth/ntlm/Scheme.h" +#include "auth/ntlm/UserRequest.h" #include "auth/State.h" #include "mgr/Registration.h" #include "Store.h" @@ -287,7 +287,7 @@ AuthNTLMConfig::decode(char const *proxy_auth) assert(auth_user_request->user() == NULL); auth_user_request->user(newUser); - auth_user_request->user()->auth_type = AUTH_NTLM; + auth_user_request->user()->auth_type = Auth::AUTH_NTLM; /* all we have to do is identify that it's NTLM - the helper does the rest */ debugs(29, 9, "AuthNTLMConfig::decode: NTLM authentication"); diff --git a/src/tests/testAuth.cc b/src/tests/testAuth.cc index 8b693067d0..db233cd166 100644 --- a/src/tests/testAuth.cc +++ b/src/tests/testAuth.cc @@ -186,7 +186,7 @@ testAuthUserRequest::scheme() } #if HAVE_AUTH_MODULE_BASIC -#include "auth/basic/basicUserRequest.h" +#include "auth/basic/UserRequest.h" #include "auth/basic/auth_basic.h" /* AuthBasicUserRequest::AuthBasicUserRequest works */ diff --git a/src/tests/testAuth.h b/src/tests/testAuth.h index b2b3212f3e..f2a17dff7b 100644 --- a/src/tests/testAuth.h +++ b/src/tests/testAuth.h @@ -47,7 +47,7 @@ protected: }; #if HAVE_AUTH_MODULE_BASIC -#include "auth/basic/basicUserRequest.h" +#include "auth/basic/UserRequest.h" class testAuthBasicUserRequest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( testAuthBasicUserRequest ); @@ -64,7 +64,7 @@ protected: #endif #if HAVE_AUTH_MODULE_DIGEST -#include "auth/digest/digestUserRequest.h" +#include "auth/digest/UserRequest.h" class testAuthDigestUserRequest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( testAuthDigestUserRequest ); @@ -81,7 +81,7 @@ protected: #endif #if HAVE_AUTH_MODULE_NTLM -#include "auth/ntlm/ntlmUserRequest.h" +#include "auth/ntlm/UserRequest.h" class testAuthNTLMUserRequest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( testAuthNTLMUserRequest ); @@ -98,7 +98,7 @@ protected: #endif #if HAVE_AUTH_MODULE_NEGOTIATE -#include "auth/negotiate/negotiateUserRequest.h" +#include "auth/negotiate/UserRequest.h" class testAuthNegotiateUserRequest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( testAuthNegotiateUserRequest );