]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceLayout: build auth sub-libraries in abstraction
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 28 Mar 2011 04:02:03 +0000 (22:02 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 28 Mar 2011 04:02:03 +0000 (22:02 -0600)
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

33 files changed:
configure.ac
src/AuthReg.cc
src/auth/Makefile.am
src/auth/Type.h [moved from src/auth/AuthType.h with 79% similarity]
src/auth/User.cc
src/auth/User.h
src/auth/UserRequest.cc
src/auth/basic/Makefile.am [new file with mode: 0644]
src/auth/basic/Scheme.cc [moved from src/auth/basic/basicScheme.cc with 98% similarity]
src/auth/basic/Scheme.h [moved from src/auth/basic/basicScheme.h with 98% similarity]
src/auth/basic/UserRequest.cc [moved from src/auth/basic/basicUserRequest.cc with 95% similarity]
src/auth/basic/UserRequest.h [moved from src/auth/basic/basicUserRequest.h with 100% similarity]
src/auth/basic/auth_basic.cc
src/auth/digest/Makefile.am [new file with mode: 0644]
src/auth/digest/Scheme.cc [moved from src/auth/digest/digestScheme.cc with 98% similarity]
src/auth/digest/Scheme.h [moved from src/auth/digest/digestScheme.h with 100% similarity]
src/auth/digest/UserRequest.cc [moved from src/auth/digest/digestUserRequest.cc with 98% similarity]
src/auth/digest/UserRequest.h [moved from src/auth/digest/digestUserRequest.h with 100% similarity]
src/auth/digest/auth_digest.cc
src/auth/negotiate/Makefile.am [new file with mode: 0644]
src/auth/negotiate/Scheme.cc [moved from src/auth/negotiate/negotiateScheme.cc with 98% similarity]
src/auth/negotiate/Scheme.h [moved from src/auth/negotiate/negotiateScheme.h with 100% similarity]
src/auth/negotiate/UserRequest.cc [moved from src/auth/negotiate/negotiateUserRequest.cc with 97% similarity]
src/auth/negotiate/UserRequest.h [moved from src/auth/negotiate/negotiateUserRequest.h with 100% similarity]
src/auth/negotiate/auth_negotiate.cc
src/auth/ntlm/Makefile.am [new file with mode: 0644]
src/auth/ntlm/Scheme.cc [moved from src/auth/ntlm/ntlmScheme.cc with 98% similarity]
src/auth/ntlm/Scheme.h [moved from src/auth/ntlm/ntlmScheme.h with 100% similarity]
src/auth/ntlm/UserRequest.cc [moved from src/auth/ntlm/ntlmUserRequest.cc with 97% similarity]
src/auth/ntlm/UserRequest.h [moved from src/auth/ntlm/ntlmUserRequest.h with 100% similarity]
src/auth/ntlm/auth_ntlm.cc
src/tests/testAuth.cc
src/tests/testAuth.h

index 81f6418644a374564fd1bd2bdc5fcdee4dbdb23c..a612b7a83ea40bbdc6228b1f80620522e57a3fc2 100644 (file)
@@ -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 \
index 079d81594e83f98c798e3c52eb1fd0c95e774e24..19c95937e338eab08ab3ad25450a3fd0fca58ac6 100644 (file)
@@ -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
 
 /**
index f6faae982efaeb34628db8f091eb3fb130308b4b..69918ee16b8049bf7a7cac2e1531e73987dab844 100644 (file)
@@ -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
similarity index 79%
rename from src/auth/AuthType.h
rename to src/auth/Type.h
index 783b4b5b9b868fc1f815d1fe471f7866a2cd0f18..3f26b8c3019aa42270af9f2661ea5726223ce0d1 100644 (file)
@@ -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
index 0e6e4effc50fb65c7ab62eb6e0f1d6daa9a2ad64..54e2446b5d3bfeb77e9f9a0b16a0ff6950b42bb4 100644 (file)
@@ -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<int32_t>(auth_user->expiretime - squid_curtime + Config.authenticateTTL),
index cf1ee5d66ef41f9eeea879eeff80ba9a940caab0..81c0f73684358cae2010a085926a017a2232b242 100644 (file)
@@ -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 */
index 0e19f908b5f1cbd931df4bddd3375f930e87702a..d0d65af89065571da64a8eb5854759588eb29613 100644 (file)
@@ -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 (file)
index 0000000..40b811f
--- /dev/null
@@ -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
similarity index 98%
rename from src/auth/basic/basicScheme.cc
rename to src/auth/basic/Scheme.cc
index f818e65919d399d4a8001bbd124541986fdf3321..ba93a05f8158b0fb2998246a8c611d826d8be340 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #include "config.h"
-#include "auth/basic/basicScheme.h"
+#include "auth/basic/Scheme.h"
 #include "helper.h"
 
 /* for AuthConfig */
similarity index 98%
rename from src/auth/basic/basicScheme.h
rename to src/auth/basic/Scheme.h
index 4bb12e3d773105147e0857d64d0913295825a7e4..587e49c5949aa0aba89f84febfd37a3bcc2c8019 100644 (file)
@@ -56,7 +56,6 @@ public:
 
 private:
     static AuthScheme::Pointer _instance;
-//    AuthBasicConfig basicConfig;
 };
 
 #endif /* SQUID_BASICSCHEME_H */
similarity index 95%
rename from src/auth/basic/basicUserRequest.cc
rename to src/auth/basic/UserRequest.cc
index aebe0f0ddbdf30b71a90f226be2d32701954dc04..622db5aa4c13810d5034ed5b11159376117b7a28 100644 (file)
@@ -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<BasicUser *>(user().getRaw());
     assert(basic_auth != NULL);
     debugs(29, 9, HERE << "'" << basic_auth->username() << ":" << basic_auth->passwd << "'");
index c854f9828113146ad9b9e5ac1e15df80e640c02b..299a22b8ad6554657ebcd71aff114729b953d01c 100644 (file)
@@ -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<AuthUserHashPointer *>(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 (file)
index 0000000..7a946de
--- /dev/null
@@ -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
similarity index 98%
rename from src/auth/digest/digestScheme.cc
rename to src/auth/digest/Scheme.cc
index f823107baf51e9ac2468d116834f0066135c9b3a..129335d55ee5fcb0424015043c6ca22c4f14ee7f 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #include "config.h"
-#include "auth/digest/digestScheme.h"
+#include "auth/digest/Scheme.h"
 #include "helper.h"
 
 AuthScheme::Pointer
similarity index 98%
rename from src/auth/digest/digestUserRequest.cc
rename to src/auth/digest/UserRequest.cc
index 2e2620dbd9b02c780648b4d7c59e74739554a7cb..63b0b84c1f62007c3b350933ff7c7a25d3527e31 100644 (file)
@@ -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<AuthDigestConfig*>(AuthConfig::Find("digest"))->authenticateProgram == NULL) {
index bdcef1cc9775afbb9298af7a4974d3b6bd22debc..05417f3b7b19f8838d1546edd18f0f8c62ba590c 100644 (file)
@@ -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<AuthUserHashPointer *>(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 (file)
index 0000000..f1b8aac
--- /dev/null
@@ -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
similarity index 98%
rename from src/auth/negotiate/negotiateScheme.cc
rename to src/auth/negotiate/Scheme.cc
index 411415a2fe71d0d9718a34a86b0ae6be1fde7b21..95c02bca78ed50ea7052fa8e5cacee7449c23bcd 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #include "config.h"
-#include "auth/negotiate/negotiateScheme.h"
+#include "auth/negotiate/Scheme.h"
 #include "helper.h"
 
 AuthScheme::Pointer
similarity index 97%
rename from src/auth/negotiate/negotiateUserRequest.cc
rename to src/auth/negotiate/UserRequest.cc
index 477e2fa20f8f7ce32e25c2327eded3054ffa7235..b6df1b6cdd5426ae112b09f8764776e78b3a347f 100644 (file)
@@ -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<helper_stateful_server*>(lastserver);
@@ -347,7 +347,8 @@ AuthNegotiateUserRequest::HandleReply(void *data, void *lastserver, char *reply)
          * string */
         AuthUserHashPointer *usernamehash = static_cast<AuthUserHashPointer *>(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<AuthUserHashPointer *>(usernamehash->next);
         if (usernamehash) {
             /* we can't seamlessly recheck the username due to the
index 7b1e3e96c5b3e00b7f1bb3493f17800071a9dc0c..faf9401e373904d02aa58f567e09def259d27673 100644 (file)
@@ -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 (file)
index 0000000..7596816
--- /dev/null
@@ -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
similarity index 98%
rename from src/auth/ntlm/ntlmScheme.cc
rename to src/auth/ntlm/Scheme.cc
index e6dee80e2c94fe54ce2af5a83a5147a6ba1c42ba..bf727d87970da7d473a75f8b05bedf0037c0ba19 100644 (file)
@@ -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
similarity index 97%
rename from src/auth/ntlm/ntlmUserRequest.cc
rename to src/auth/ntlm/UserRequest.cc
index cce95b23ac37c5a15cbdc6c94b72ca06d3da39fa..6aa7bd8d2509b091a0adc1a999ced0be21924c48 100644 (file)
@@ -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<AuthUserHashPointer *>(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<AuthUserHashPointer *>(usernamehash->next);
         if (usernamehash) {
             /* we can't seamlessly recheck the username due to the
index de52cb58e3c390679338e44f626d2018b65b0118..a38d5243611bc43f35db5ce8fc0bf2ef1fe32bbe 100644 (file)
@@ -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");
index 8b693067d0fd983722734a3878e7276e80b52491..db233cd166c291f6780e7d6a55d2412340a3d0cc 100644 (file)
@@ -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
  */
index b2b3212f3ebc63aa554b14e6b8e8ef760de26fa8..f2a17dff7bd723d7836cfedcc500dccbcccdac32 100644 (file)
@@ -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 );