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)
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 \
#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
/**
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 \
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
#if USE_AUTH
+namespace Auth {
+
typedef enum {
AUTH_UNKNOWN, /* default */
AUTH_BASIC,
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
AuthUser::AuthUser(AuthConfig *aConfig) :
- auth_type(AUTH_UNKNOWN),
+ auth_type(Auth::AUTH_UNKNOWN),
config(aConfig),
ipcount(0),
expiretime(0),
xfree((char*)username_);
/* prevent accidental reuse */
- auth_type = AUTH_UNKNOWN;
+ auth_type = Auth::AUTH_UNKNOWN;
}
void
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),
#if USE_AUTH
-#include "auth/AuthType.h"
+#include "auth/Type.h"
#include "dlink.h"
#include "ip/Address.h"
#include "RefCount.h"
* 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 */
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;
}
--- /dev/null
+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
*/
#include "config.h"
-#include "auth/basic/basicScheme.h"
+#include "auth/basic/Scheme.h"
#include "helper.h"
/* for AuthConfig */
private:
static AuthScheme::Pointer _instance;
-// AuthBasicConfig basicConfig;
};
#endif /* SQUID_BASICSCHEME_H */
#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
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()) {
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 << "'");
#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"
}
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 */
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();
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;
}
/* 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;
--- /dev/null
+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
*/
#include "config.h"
-#include "auth/digest/digestScheme.h"
+#include "auth/digest/Scheme.h"
#include "helper.h"
AuthScheme::Pointer
#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"
int
AuthDigestUserRequest::module_direction()
{
- if (user()->auth_type != AUTH_DIGEST)
+ if (user()->auth_type != Auth::AUTH_DIGEST)
return -2;
switch (user()->credentials()) {
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) {
#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"
#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 */
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();
}
}
/* 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;
/* 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 */
--- /dev/null
+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
*/
#include "config.h"
-#include "auth/negotiate/negotiateScheme.h"
+#include "auth/negotiate/Scheme.h"
#include "helper.h"
AuthScheme::Pointer
#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"
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()) {
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() << "'");
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);
* 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
#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"
/**
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");
--- /dev/null
+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
#include "config.h"
#include "auth/ntlm/auth_ntlm.h"
-#include "auth/ntlm/ntlmScheme.h"
+#include "auth/ntlm/Scheme.h"
#include "helper.h"
AuthScheme::Pointer
#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"
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()) {
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);
* 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
#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"
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");
}
#if HAVE_AUTH_MODULE_BASIC
-#include "auth/basic/basicUserRequest.h"
+#include "auth/basic/UserRequest.h"
#include "auth/basic/auth_basic.h"
/* AuthBasicUserRequest::AuthBasicUserRequest works
*/
};
#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 );
#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 );
#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 );
#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 );