]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceLayout: namespace for Auth::Config children
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 10 Apr 2011 01:31:59 +0000 (19:31 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 10 Apr 2011 01:31:59 +0000 (19:31 -0600)
No Logic changes.

Also, no code shuffling which should normally have been done with namespace.
Config children are currently too intwined with UserRequest children and
helper management. Logic changes are required before that can be done.

16 files changed:
src/auth/basic/Scheme.cc
src/auth/basic/UserRequest.cc
src/auth/basic/auth_basic.cc
src/auth/basic/auth_basic.h
src/auth/digest/Scheme.cc
src/auth/digest/UserRequest.cc
src/auth/digest/auth_digest.cc
src/auth/digest/auth_digest.h
src/auth/negotiate/Scheme.cc
src/auth/negotiate/UserRequest.cc
src/auth/negotiate/auth_negotiate.cc
src/auth/negotiate/auth_negotiate.h
src/auth/ntlm/Scheme.cc
src/auth/ntlm/UserRequest.cc
src/auth/ntlm/auth_ntlm.cc
src/auth/ntlm/auth_ntlm.h

index 7043b7da8be87660ce8b007ea0cd0b4b84a61ec5..0dd718ac4deba0a2e2396f59bfe1efbae80bd62e 100644 (file)
@@ -68,6 +68,6 @@ Auth::Basic::Scheme::shutdownCleanup()
 Auth::Config *
 Auth::Basic::Scheme::createConfig()
 {
-    AuthBasicConfig *newCfg = new AuthBasicConfig;
+    Auth::Basic::Config *newCfg = new Auth::Basic::Config;
     return dynamic_cast<Auth::Config*>(newCfg);
 }
index dce899a11c613cf830ec5ba6e7cd01f11cc0268c..c35939f6065b34624f2dd261a311c8cf3feaa917 100644 (file)
@@ -26,7 +26,7 @@ AuthBasicUserRequest::authenticate(HttpRequest * request, ConnStateData * conn,
         return;
 
     /* are we about to recheck the credentials externally? */
-    if ((user()->expiretime + static_cast<AuthBasicConfig*>(Auth::Config::Find("basic"))->credentialsTTL) <= squid_curtime) {
+    if ((user()->expiretime + static_cast<Auth::Basic::Config*>(Auth::Config::Find("basic"))->credentialsTTL) <= squid_curtime) {
         debugs(29, 4, HERE << "credentials expired - rechecking");
         return;
     }
@@ -55,7 +55,7 @@ AuthBasicUserRequest::module_direction()
         return -1;
 
     case AuthUser::Ok:
-        if (user()->expiretime + static_cast<AuthBasicConfig*>(Auth::Config::Find("basic"))->credentialsTTL <= squid_curtime)
+        if (user()->expiretime + static_cast<Auth::Basic::Config*>(Auth::Config::Find("basic"))->credentialsTTL <= squid_curtime)
             return -1;
         return 0;
 
@@ -76,7 +76,7 @@ AuthBasicUserRequest::module_start(RH * handler, void *data)
     assert(basic_auth != NULL);
     debugs(29, 9, HERE << "'" << basic_auth->username() << ":" << basic_auth->passwd << "'");
 
-    if (static_cast<AuthBasicConfig*>(Auth::Config::Find("basic"))->authenticateProgram == NULL) {
+    if (static_cast<Auth::Basic::Config*>(Auth::Config::Find("basic"))->authenticateProgram == NULL) {
         debugs(29, DBG_CRITICAL, "ERROR: No Basic authentication program configured.");
         handler(data, NULL);
         return;
index 661a5b0cc16ef680c20577fef8bfd290ce59d446..86ccb1bbaa3d2555697019e4dd5eddcfb539bfab 100644 (file)
@@ -70,13 +70,13 @@ static int authbasic_initialised = 0;
 /* internal functions */
 
 bool
-AuthBasicConfig::active() const
+Auth::Basic::Config::active() const
 {
     return authbasic_initialised == 1;
 }
 
 bool
-AuthBasicConfig::configured() const
+Auth::Basic::Config::configured() const
 {
     if ((authenticateProgram != NULL) && (authenticateChildren.n_max != 0) &&
             (basicAuthRealm != NULL)) {
@@ -89,7 +89,7 @@ AuthBasicConfig::configured() const
 }
 
 const char *
-AuthBasicConfig::type() const
+Auth::Basic::Config::type() const
 {
     return Auth::Basic::Scheme::GetInstance()->type();
 }
@@ -100,7 +100,7 @@ BasicUser::ttl() const
     if (credentials() != Ok && credentials() != Pending)
         return -1; // TTL is obsolete NOW.
 
-    int32_t basic_ttl = expiretime - squid_curtime + static_cast<AuthBasicConfig*>(config)->credentialsTTL;
+    int32_t basic_ttl = expiretime - squid_curtime + static_cast<Auth::Basic::Config*>(config)->credentialsTTL;
     int32_t global_ttl = static_cast<int32_t>(expiretime - squid_curtime + Config.authenticateTTL);
 
     return min(basic_ttl, global_ttl);
@@ -109,7 +109,7 @@ BasicUser::ttl() const
 bool
 BasicUser::authenticated() const
 {
-    if ((credentials() == Ok) && (expiretime + static_cast<AuthBasicConfig*>(config)->credentialsTTL > squid_curtime))
+    if ((credentials() == Ok) && (expiretime + static_cast<Auth::Basic::Config*>(config)->credentialsTTL > squid_curtime))
         return true;
 
     debugs(29, 4, "User not authenticated or credentials need rechecking.");
@@ -118,7 +118,7 @@ BasicUser::authenticated() const
 }
 
 void
-AuthBasicConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
+Auth::Basic::Config::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
 {
     if (authenticateProgram) {
         debugs(29, 9, HERE << "Sending type:" << hdrType << " header: 'Basic realm=\"" << basicAuthRealm << "\"'");
@@ -127,7 +127,7 @@ AuthBasicConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply
 }
 
 void
-AuthBasicConfig::rotateHelpers()
+Auth::Basic::Config::rotateHelpers()
 {
     /* schedule closure of existing helpers */
     if (basicauthenticators) {
@@ -139,7 +139,7 @@ AuthBasicConfig::rotateHelpers()
 
 /** shutdown the auth helpers and free any allocated configuration details */
 void
-AuthBasicConfig::done()
+Auth::Basic::Config::done()
 {
     authbasic_initialised = 0;
 
@@ -219,7 +219,7 @@ authenticateBasicHandleReply(void *data, char *reply)
 }
 
 void
-AuthBasicConfig::dump(StoreEntry * entry, const char *name, Auth::Config * scheme)
+Auth::Basic::Config::dump(StoreEntry * entry, const char *name, Auth::Config * scheme)
 {
     wordlist *list = authenticateProgram;
     storeAppendPrintf(entry, "%s %s", name, "basic");
@@ -237,7 +237,7 @@ AuthBasicConfig::dump(StoreEntry * entry, const char *name, Auth::Config * schem
     storeAppendPrintf(entry, "%s basic casesensitive %s\n", name, casesensitive ? "on" : "off");
 }
 
-AuthBasicConfig::AuthBasicConfig() :
+Auth::Basic::Config::Config() :
         credentialsTTL( 2*60*60 ),
         casesensitive(0),
         utf8(0)
@@ -245,13 +245,13 @@ AuthBasicConfig::AuthBasicConfig() :
     basicAuthRealm = xstrdup("Squid proxy-caching web server");
 }
 
-AuthBasicConfig::~AuthBasicConfig()
+Auth::Basic::Config::~Config()
 {
     safe_free(basicAuthRealm);
 }
 
 void
-AuthBasicConfig::parse(Auth::Config * scheme, int n_configured, char *param_str)
+Auth::Basic::Config::parse(Auth::Config * scheme, int n_configured, char *param_str)
 {
     if (strcasecmp(param_str, "program") == 0) {
         if (authenticateProgram)
@@ -308,7 +308,7 @@ BasicUser::BasicUser(Auth::Config *aConfig) :
 {}
 
 char *
-AuthBasicConfig::decodeCleartext(const char *httpAuthHeader)
+Auth::Basic::Config::decodeCleartext(const char *httpAuthHeader)
 {
     const char *proxy_auth = httpAuthHeader;
 
@@ -381,7 +381,7 @@ BasicUser::updateCached(BasicUser *from)
  * descriptive message to the user.
  */
 AuthUserRequest::Pointer
-AuthBasicConfig::decode(char const *proxy_auth)
+Auth::Basic::Config::decode(char const *proxy_auth)
 {
     AuthUserRequest::Pointer auth_user_request = dynamic_cast<AuthUserRequest*>(new AuthBasicUserRequest);
     /* decode the username */
@@ -466,7 +466,7 @@ AuthBasicConfig::decode(char const *proxy_auth)
 /** Initialize helpers and the like for this auth scheme. Called AFTER parsing the
  * config file */
 void
-AuthBasicConfig::init(Auth::Config * schemeCfg)
+Auth::Basic::Config::init(Auth::Config * schemeCfg)
 {
     if (authenticateProgram) {
         authbasic_initialised = 1;
@@ -487,7 +487,7 @@ AuthBasicConfig::init(Auth::Config * schemeCfg)
 }
 
 void
-AuthBasicConfig::registerWithCacheManager(void)
+Auth::Basic::Config::registerWithCacheManager(void)
 {
     Mgr::RegisterAction("basicauthenticator",
                         "Basic User Authenticator Stats",
@@ -520,7 +520,7 @@ BasicUser::submitRequest(AuthUserRequest::Pointer auth_user_request, RH * handle
     r->handler = handler;
     r->data = cbdataReference(data);
     r->auth_user_request = auth_user_request;
-    if (static_cast<AuthBasicConfig*>(config)->utf8) {
+    if (static_cast<Auth::Basic::Config*>(config)->utf8) {
         latin1_to_utf8(user, sizeof(user), username());
         latin1_to_utf8(pass, sizeof(pass), passwd);
         xstrncpy(user, rfc1738_escape(user), sizeof(user));
index e2891320be0fb97f2a3f1eb7828294b0cbc4193b..7530b7ebb4d28cd2a136fb6630c48133b9d5e0c6 100644 (file)
@@ -53,14 +53,15 @@ private:
 
 MEMPROXY_CLASS_INLINE(BasicUser);
 
-/* configuration runtime data */
+namespace Auth {
+namespace Basic {
 
-class AuthBasicConfig : public Auth::Config
+/** Basic authentication configuration data */
+class Config : public Auth::Config
 {
-
 public:
-    AuthBasicConfig();
-    ~AuthBasicConfig();
+    Config();
+    ~Config();
     virtual bool active() const;
     virtual bool configured() const;
     virtual AuthUserRequest::Pointer decode(char const *proxy_auth);
@@ -73,6 +74,8 @@ public:
     void decode(char const *httpAuthHeader, AuthUserRequest::Pointer);
     virtual void registerWithCacheManager(void);
     virtual const char * type() const;
+
+public:
     char *basicAuthRealm;
     time_t credentialsTTL;
     int casesensitive;
@@ -82,4 +85,7 @@ private:
     char * decodeCleartext(const char *httpAuthHeader);
 };
 
+} // namespace Basic
+} // namespace Auth
+
 #endif /* __AUTH_BASIC_H__ */
index 87ed0b23c16ad8c035f47f2a196853f8db79b67f..86f9c83b1edd995afbb41402d2162b0740ff0d4c 100644 (file)
@@ -68,7 +68,7 @@ Auth::Digest::Scheme::shutdownCleanup()
 Auth::Config *
 Auth::Digest::Scheme::createConfig()
 {
-    AuthDigestConfig *digestCfg = new AuthDigestConfig;
+    Auth::Digest::Config *digestCfg = new Auth::Digest::Config;
     return dynamic_cast<Auth::Config*>(digestCfg);
 }
 
index 3b84b0878bd07f3d73fb10fcf71ef9b1443019f7..7e1888656e0ad287ff8da76ebb81314811bcff4c 100644 (file)
@@ -102,7 +102,7 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData * conn,
             return;
         }
 
-        if (static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->PostWorkaround && request->method != METHOD_GET) {
+        if (static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->PostWorkaround && request->method != METHOD_GET) {
             /* Ugly workaround for certain very broken browsers using the
              * wrong method to calculate the request-digest on POST request.
              * This should be deleted once Digest authentication becomes more
@@ -209,7 +209,7 @@ AuthDigestUserRequest::addHeader(HttpReply * rep, int accel)
         return;
 #endif
 
-    if ((static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->authenticateProgram) && authDigestNonceLastRequest(nonce)) {
+    if ((static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->authenticateProgram) && authDigestNonceLastRequest(nonce)) {
         flags.authinfo_sent = 1;
         debugs(29, 9, "authDigestAddHead: Sending type:" << type << " header: 'nextnonce=\"" << authenticateDigestNonceNonceb64(nonce) << "\"");
         httpHeaderPutStrf(&rep->header, type, "nextnonce=\"%s\"", authenticateDigestNonceNonceb64(nonce));
@@ -237,7 +237,7 @@ AuthDigestUserRequest::addTrailer(HttpReply * rep, int accel)
 
     type = accel ? HDR_AUTHENTICATION_INFO : HDR_PROXY_AUTHENTICATION_INFO;
 
-    if ((static_cast<AuthDigestConfig*>(digestScheme::GetInstance()->getConfig())->authenticate) && authDigestNonceLastRequest(nonce)) {
+    if ((static_cast<Auth::Digest::Config*>(digestScheme::GetInstance()->getConfig())->authenticate) && authDigestNonceLastRequest(nonce)) {
         debugs(29, 9, "authDigestAddTrailer: Sending type:" << type << " header: 'nextnonce=\"" << authenticateDigestNonceNonceb64(nonce) << "\"");
         httpTrailerPutStrf(&rep->header, type, "nextnonce=\"%s\"", authenticateDigestNonceNonceb64(nonce));
     }
@@ -254,7 +254,7 @@ AuthDigestUserRequest::module_start(RH * handler, void *data)
     assert(user() != NULL && user()->auth_type == Auth::AUTH_DIGEST);
     debugs(29, 9, "authenticateStart: '\"" << user()->username() << "\":\"" << realm << "\"'");
 
-    if (static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->authenticateProgram == NULL) {
+    if (static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->authenticateProgram == NULL) {
         debugs(29, DBG_CRITICAL, "ERROR: No Digest authentication program configured.");
         handler(data, NULL);
         return;
@@ -264,7 +264,7 @@ AuthDigestUserRequest::module_start(RH * handler, void *data)
     r->handler = handler;
     r->data = cbdataReference(data);
     r->auth_user_request = static_cast<AuthUserRequest*>(this);
-    if (static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->utf8) {
+    if (static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->utf8) {
         char userstr[1024];
         latin1_to_utf8(userstr, sizeof(userstr), user()->username());
         snprintf(buf, 8192, "\"%s\":\"%s\"\n", userstr, realm);
index 792360980a6885ddca1787568105ce8fb9f863f5..cb998d83173df2285169dd3b276ae1677cd63bdf 100644 (file)
@@ -225,7 +225,7 @@ authenticateDigestNonceSetup(void)
     if (!digest_nonce_cache) {
         digest_nonce_cache = hash_create((HASHCMP *) strcmp, 7921, hash_string);
         assert(digest_nonce_cache);
-        eventAdd("Digest none cache maintenance", authenticateDigestNonceCacheCleanup, NULL, static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->nonceGCInterval, 1);
+        eventAdd("Digest none cache maintenance", authenticateDigestNonceCacheCleanup, NULL, static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->nonceGCInterval, 1);
     }
 }
 
@@ -288,8 +288,8 @@ authenticateDigestNonceCacheCleanup(void *data)
 
     debugs(29, 3, "authenticateDigestNonceCacheCleanup: Finished cleaning the nonce cache.");
 
-    if (static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->active())
-        eventAdd("Digest none cache maintenance", authenticateDigestNonceCacheCleanup, NULL, static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->nonceGCInterval, 1);
+    if (static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->active())
+        eventAdd("Digest none cache maintenance", authenticateDigestNonceCacheCleanup, NULL, static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->nonceGCInterval, 1);
 }
 
 static void
@@ -376,12 +376,12 @@ authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9])
     }
 
     /* is the nonce-count ok ? */
-    if (!static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->CheckNonceCount) {
+    if (!static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->CheckNonceCount) {
         nonce->nc++;
         return -1;              /* forced OK by configuration */
     }
 
-    if ((static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->NonceStrictness && intnc != nonce->nc + 1) ||
+    if ((static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->NonceStrictness && intnc != nonce->nc + 1) ||
             intnc < nonce->nc + 1) {
         debugs(29, 4, "authDigestNonceIsValid: Nonce count doesn't match");
         nonce->flags.valid = 0;
@@ -406,10 +406,10 @@ authDigestNonceIsStale(digest_nonce_h * nonce)
         return -1;
 
     /* has it's max duration expired? */
-    if (nonce->noncedata.creationtime + static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->noncemaxduration < current_time.tv_sec) {
+    if (nonce->noncedata.creationtime + static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->noncemaxduration < current_time.tv_sec) {
         debugs(29, 4, "authDigestNonceIsStale: Nonce is too old. " <<
                nonce->noncedata.creationtime << " " <<
-               static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->noncemaxduration << " " <<
+               static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->noncemaxduration << " " <<
                current_time.tv_sec);
 
         nonce->flags.valid = 0;
@@ -422,7 +422,7 @@ authDigestNonceIsStale(digest_nonce_h * nonce)
         return -1;
     }
 
-    if (nonce->nc > static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->noncemaxuses) {
+    if (nonce->nc > static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->noncemaxuses) {
         debugs(29, 4, "authDigestNoncelastRequest: Nonce count over user limit");
         nonce->flags.valid = 0;
         return -1;
@@ -447,7 +447,7 @@ authDigestNonceLastRequest(digest_nonce_h * nonce)
         return -1;
     }
 
-    if (nonce->nc >= static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->noncemaxuses - 1) {
+    if (nonce->nc >= static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->noncemaxuses - 1) {
         debugs(29, 4, "authDigestNoncelastRequest: Nonce count about to hit user limit");
         return -1;
     }
@@ -493,7 +493,7 @@ authDigestUserFindUsername(const char *username)
 }
 
 void
-AuthDigestConfig::rotateHelpers()
+Auth::Digest::Config::rotateHelpers()
 {
     /* schedule closure of existing helpers */
     if (digestauthenticators) {
@@ -504,7 +504,7 @@ AuthDigestConfig::rotateHelpers()
 }
 
 void
-AuthDigestConfig::dump(StoreEntry * entry, const char *name, Auth::Config * scheme)
+Auth::Digest::Config::dump(StoreEntry * entry, const char *name, Auth::Config * scheme)
 {
     wordlist *list = authenticateProgram;
     debugs(29, 9, "authDigestCfgDump: Dumping configuration");
@@ -524,13 +524,13 @@ AuthDigestConfig::dump(StoreEntry * entry, const char *name, Auth::Config * sche
 }
 
 bool
-AuthDigestConfig::active() const
+Auth::Digest::Config::active() const
 {
     return authdigest_initialised == 1;
 }
 
 bool
-AuthDigestConfig::configured() const
+Auth::Digest::Config::configured() const
 {
     if ((authenticateProgram != NULL) &&
             (authenticateChildren.n_max != 0) &&
@@ -542,7 +542,7 @@ AuthDigestConfig::configured() const
 
 /* add the [www-|Proxy-]authenticate header on a 407 or 401 reply */
 void
-AuthDigestConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
+Auth::Digest::Config::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
 {
     if (!authenticateProgram)
         return;
@@ -602,7 +602,7 @@ DigestUser::ttl() const
     if (latest_nonce == -1)
         return min(-1, global_ttl);
 
-    int32_t nonce_ttl = latest_nonce - current_time.tv_sec + static_cast<AuthDigestConfig*>(Auth::Config::Find("digest"))->noncemaxduration;
+    int32_t nonce_ttl = latest_nonce - current_time.tv_sec + static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->noncemaxduration;
 
     return min(nonce_ttl, global_ttl);
 }
@@ -610,7 +610,7 @@ DigestUser::ttl() const
 /* Initialize helpers and the like for this auth scheme. Called AFTER parsing the
  * config file */
 void
-AuthDigestConfig::init(Auth::Config * scheme)
+Auth::Digest::Config::init(Auth::Config * scheme)
 {
     if (authenticateProgram) {
         DigestFieldsInfo = httpHeaderBuildFieldsInfo(DigestAttrs, DIGEST_ENUM_END);
@@ -633,7 +633,7 @@ AuthDigestConfig::init(Auth::Config * scheme)
 }
 
 void
-AuthDigestConfig::registerWithCacheManager(void)
+Auth::Digest::Config::registerWithCacheManager(void)
 {
     Mgr::RegisterAction("digestauthenticator",
                         "Digest User Authenticator Stats",
@@ -642,7 +642,7 @@ AuthDigestConfig::registerWithCacheManager(void)
 
 /* free any allocated configuration details */
 void
-AuthDigestConfig::done()
+Auth::Digest::Config::done()
 {
     authdigest_initialised = 0;
 
@@ -666,7 +666,7 @@ AuthDigestConfig::done()
     safe_free(digestAuthRealm);
 }
 
-AuthDigestConfig::AuthDigestConfig()
+Auth::Digest::Config::Config()
 {
     /* TODO: move into initialisation list */
     /* 5 minutes */
@@ -682,7 +682,7 @@ AuthDigestConfig::AuthDigestConfig()
 }
 
 void
-AuthDigestConfig::parse(Auth::Config * scheme, int n_configured, char *param_str)
+Auth::Digest::Config::parse(Auth::Config * scheme, int n_configured, char *param_str)
 {
     if (strcasecmp(param_str, "program") == 0) {
         if (authenticateProgram)
@@ -715,7 +715,7 @@ AuthDigestConfig::parse(Auth::Config * scheme, int n_configured, char *param_str
 }
 
 const char *
-AuthDigestConfig::type() const
+Auth::Digest::Config::type() const
 {
     return Auth::Digest::Scheme::GetInstance()->type();
 }
@@ -810,7 +810,7 @@ authDigestLogUsername(char *username, AuthUserRequest::Pointer auth_user_request
 
     /* log the username */
     debugs(29, 9, "authDigestLogUsername: Creating new user for logging '" << username << "'");
-    AuthUser::Pointer digest_user = new DigestUser(static_cast<AuthDigestConfig*>(Auth::Config::Find("digest")));
+    AuthUser::Pointer digest_user = new DigestUser(static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest")));
     /* save the credentials */
     digest_user->username(username);
     /* set the auth_user type */
@@ -825,7 +825,7 @@ authDigestLogUsername(char *username, AuthUserRequest::Pointer auth_user_request
  * Auth_user structure.
  */
 AuthUserRequest::Pointer
-AuthDigestConfig::decode(char const *proxy_auth)
+Auth::Digest::Config::decode(char const *proxy_auth)
 {
     const char *item;
     const char *p;
index 09942abba47afd2b5fe8f912cfee34d46f471598..a7d61b6310bdacdc7d42db5141a8abf130a92096 100644 (file)
@@ -76,13 +76,14 @@ extern const char *authenticateDigestNonceNonceb64(const digest_nonce_h * nonce)
 extern int authDigestNonceLastRequest(digest_nonce_h * nonce);
 extern void authenticateDigestNonceShutdown(void);
 
-/* configuration runtime data */
+namespace Auth {
+namespace Digest {
 
-class AuthDigestConfig : public Auth::Config
+/** Digest Authentication configuration data */
+class Config : public Auth::Config
 {
-
 public:
-    AuthDigestConfig();
+    Config();
     virtual bool active() const;
     virtual bool configured() const;
     virtual AuthUserRequest::Pointer decode(char const *proxy_auth);
@@ -106,7 +107,8 @@ public:
     int utf8;
 };
 
-typedef class AuthDigestConfig auth_digest_config;
+} // namespace Digest
+} // namespace Auth
 
 /* strings */
 #define QOP_AUTH "auth"
index 7ae08b63b9e05a7e22fd5aa757f63d7a38b2d720..5b4f905647439d8b132c225ae6f7d6140b6c9886 100644 (file)
@@ -65,6 +65,6 @@ Auth::Negotiate::Scheme::shutdownCleanup()
 Auth::Config *
 Auth::Negotiate::Scheme::createConfig()
 {
-    AuthNegotiateConfig *negotiateCfg = new AuthNegotiateConfig;
+    Auth::Negotiate::Config *negotiateCfg = new Auth::Negotiate::Config;
     return dynamic_cast<Auth::Config*>(negotiateCfg);
 }
index cec4c2ae96723ffa4257c6c1bba3a579999352b5..1af59bf216e7429c76880794c1bf4a8d67f7e4e3 100644 (file)
@@ -121,7 +121,7 @@ AuthNegotiateUserRequest::module_start(RH * handler, void *data)
 
     debugs(29, 8, HERE << "auth state is '" << user()->credentials() << "'");
 
-    if (static_cast<AuthNegotiateConfig*>(Auth::Config::Find("negotiate"))->authenticateProgram == NULL) {
+    if (static_cast<Auth::Negotiate::Config*>(Auth::Config::Find("negotiate"))->authenticateProgram == NULL) {
         debugs(29, DBG_CRITICAL, "ERROR: No Negotiate authentication program configured.");
         handler(data, NULL);
         return;
index 6f6358943d35901ed33d9880eb8c2b0532b7b3fe..c8f01f9839bc864b0dff6e6e354de662dbf4fdca 100644 (file)
@@ -66,7 +66,7 @@ statefulhelper *negotiateauthenticators = NULL;
 static int authnegotiate_initialised = 0;
 
 /// \ingroup AuthNegotiateInternal
-AuthNegotiateConfig negotiateConfig;
+Auth::Negotiate::Config negotiateConfig;
 
 /// \ingroup AuthNegotiateInternal
 static hash_table *proxy_auth_cache = NULL;
@@ -78,7 +78,7 @@ static hash_table *proxy_auth_cache = NULL;
  */
 
 void
-AuthNegotiateConfig::rotateHelpers()
+Auth::Negotiate::Config::rotateHelpers()
 {
     /* schedule closure of existing helpers */
     if (negotiateauthenticators) {
@@ -89,7 +89,7 @@ AuthNegotiateConfig::rotateHelpers()
 }
 
 void
-AuthNegotiateConfig::done()
+Auth::Negotiate::Config::done()
 {
     authnegotiate_initialised = 0;
 
@@ -106,11 +106,11 @@ AuthNegotiateConfig::done()
     if (authenticateProgram)
         wordlistDestroy(&authenticateProgram);
 
-    debugs(29, 2, "negotiateScheme::done: Negotiate authentication Shutdown.");
+    debugs(29, DBG_IMPORTANT, "Reconfigure: Negotiate authentication configuration cleared.");
 }
 
 void
-AuthNegotiateConfig::dump(StoreEntry * entry, const char *name, Auth::Config * scheme)
+Auth::Negotiate::Config::dump(StoreEntry * entry, const char *name, Auth::Config * scheme)
 {
     wordlist *list = authenticateProgram;
     storeAppendPrintf(entry, "%s %s", name, "negotiate");
@@ -126,11 +126,11 @@ AuthNegotiateConfig::dump(StoreEntry * entry, const char *name, Auth::Config * s
 
 }
 
-AuthNegotiateConfig::AuthNegotiateConfig() : keep_alive(1)
+Auth::Negotiate::Config::Config() : keep_alive(1)
 { }
 
 void
-AuthNegotiateConfig::parse(Auth::Config * scheme, int n_configured, char *param_str)
+Auth::Negotiate::Config::parse(Auth::Config * scheme, int n_configured, char *param_str)
 {
     if (strcasecmp(param_str, "program") == 0) {
         if (authenticateProgram)
@@ -144,12 +144,12 @@ AuthNegotiateConfig::parse(Auth::Config * scheme, int n_configured, char *param_
     } else if (strcasecmp(param_str, "keep_alive") == 0) {
         parse_onoff(&keep_alive);
     } else {
-        debugs(29, 0, "AuthNegotiateConfig::parse: unrecognised negotiate auth scheme parameter '" << param_str << "'");
+        debugs(29, DBG_CRITICAL, "ERROR: unrecognised Negotiate auth scheme parameter '" << param_str << "'");
     }
 }
 
 const char *
-AuthNegotiateConfig::type() const
+Auth::Negotiate::Config::type() const
 {
     return Auth::Negotiate::Scheme::GetInstance()->type();
 }
@@ -159,7 +159,7 @@ AuthNegotiateConfig::type() const
  * Called AFTER parsing the config file
  */
 void
-AuthNegotiateConfig::init(Auth::Config * scheme)
+Auth::Negotiate::Config::init(Auth::Config * scheme)
 {
     if (authenticateProgram) {
 
@@ -186,7 +186,7 @@ AuthNegotiateConfig::init(Auth::Config * scheme)
 }
 
 void
-AuthNegotiateConfig::registerWithCacheManager(void)
+Auth::Negotiate::Config::registerWithCacheManager(void)
 {
     Mgr::RegisterAction("negotiateauthenticator",
                         "Negotiate User Authenticator Stats",
@@ -194,27 +194,27 @@ AuthNegotiateConfig::registerWithCacheManager(void)
 }
 
 bool
-AuthNegotiateConfig::active() const
+Auth::Negotiate::Config::active() const
 {
     return authnegotiate_initialised == 1;
 }
 
 bool
-AuthNegotiateConfig::configured() const
+Auth::Negotiate::Config::configured() const
 {
     if (authenticateProgram && (authenticateChildren.n_max != 0)) {
-        debugs(29, 9, "AuthNegotiateConfig::configured: returning configured");
+        debugs(29, 9, HERE << "returning configured");
         return true;
     }
 
-    debugs(29, 9, "AuthNegotiateConfig::configured: returning unconfigured");
+    debugs(29, 9, HERE << "returning unconfigured");
     return false;
 }
 
 /* Negotiate Scheme */
 
 void
-AuthNegotiateConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply *rep, http_hdr_type reqType, HttpRequest * request)
+Auth::Negotiate::Config::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply *rep, http_hdr_type reqType, HttpRequest * request)
 {
     AuthNegotiateUserRequest *negotiate_request;
 
@@ -227,7 +227,7 @@ AuthNegotiateConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpR
 
     /* New request, no user details */
     if (auth_user_request == NULL) {
-        debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate'");
+        debugs(29, 9, HERE << "Sending type:" << reqType << " header: 'Negotiate'");
         httpHeaderPutStrf(&rep->header, reqType, "Negotiate");
 
         if (!keep_alive) {
@@ -253,11 +253,11 @@ AuthNegotiateConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpR
              * Need to start over to give the client another chance.
              */
             if (negotiate_request->server_blob) {
-                debugs(29, 9, "authenticateNegotiateFixErrorHeader: Sending type:" << reqType << " header: 'Negotiate " << negotiate_request->server_blob << "'");
+                debugs(29, 9, HERE << "Sending type:" << reqType << " header: 'Negotiate " << negotiate_request->server_blob << "'");
                 httpHeaderPutStrf(&rep->header, reqType, "Negotiate %s", negotiate_request->server_blob);
                 safe_free(negotiate_request->server_blob);
             } else {
-                debugs(29, 9, "authenticateNegotiateFixErrorHeader: Connection authenticated");
+                debugs(29, 9, HERE << "Connection authenticated");
                 httpHeaderPutStrf(&rep->header, reqType, "Negotiate");
             }
             break;
@@ -265,19 +265,19 @@ AuthNegotiateConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpR
         case AuthUser::Unchecked:
             /* semantic change: do not drop the connection.
              * 2.5 implementation used to keep it open - Kinkie */
-            debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate'");
+            debugs(29, 9, HERE << "Sending type:" << reqType << " header: 'Negotiate'");
             httpHeaderPutStrf(&rep->header, reqType, "Negotiate");
             break;
 
         case AuthUser::Handshake:
             /* we're waiting for a response from the client. Pass it the blob */
-            debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate " << negotiate_request->server_blob << "'");
+            debugs(29, 9, HERE << "Sending type:" << reqType << " header: 'Negotiate " << negotiate_request->server_blob << "'");
             httpHeaderPutStrf(&rep->header, reqType, "Negotiate %s", negotiate_request->server_blob);
             safe_free(negotiate_request->server_blob);
             break;
 
         default:
-            debugs(29, DBG_CRITICAL, "AuthNegotiateConfig::fixHeader: state " << negotiate_request->user()->credentials() << ".");
+            debugs(29, DBG_CRITICAL, "ERROR: Negotiate auth fixHeader: state " << negotiate_request->user()->credentials() << ".");
             fatal("unexpected state in AuthenticateNegotiateFixErrorHeader.\n");
         }
     }
@@ -285,7 +285,7 @@ AuthNegotiateConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpR
 
 NegotiateUser::~NegotiateUser()
 {
-    debugs(29, 5, "NegotiateUser::~NegotiateUser: doing nothing to clearNegotiate scheme data for '" << this << "'");
+    debugs(29, 5, HERE << "doing nothing to clearNegotiate scheme data for '" << this << "'");
 }
 
 int32_t
@@ -305,7 +305,7 @@ authenticateNegotiateStats(StoreEntry * sentry)
  * Auth_user structure.
  */
 AuthUserRequest::Pointer
-AuthNegotiateConfig::decode(char const *proxy_auth)
+Auth::Negotiate::Config::decode(char const *proxy_auth)
 {
     NegotiateUser *newUser = new NegotiateUser(&negotiateConfig);
     AuthUserRequest *auth_user_request = new AuthNegotiateUserRequest();
@@ -315,7 +315,7 @@ AuthNegotiateConfig::decode(char const *proxy_auth)
     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");
+    debugs(29, 9, HERE << "decode Negotiate authentication");
     return auth_user_request;
 }
 
index 11ffd93ed5106916cdbbfccc2497d05f3cd5e1ff..0d1b4e2ae4e41a938905690ff082930977af77ca 100644 (file)
@@ -38,14 +38,14 @@ MEMPROXY_CLASS_INLINE(NegotiateUser);
 
 extern statefulhelper *negotiateauthenticators;
 
-/* configuration runtime data */
+namespace Auth {
+namespace Negotiate {
 
-/// \ingroup AuthNegotiateAPI
-class AuthNegotiateConfig : public Auth::Config
+/** Negotiate Authentication configuration data */
+class Config : public Auth::Config
 {
-
 public:
-    AuthNegotiateConfig();
+    Config();
     virtual bool active() const;
     virtual bool configured() const;
     virtual AuthUserRequest::Pointer decode(char const *proxy_auth);
@@ -57,9 +57,12 @@ public:
     virtual void parse(Auth::Config *, int, char *);
     virtual void registerWithCacheManager(void);
     virtual const char * type() const;
+
+public:
     int keep_alive;
 };
 
-extern AuthNegotiateConfig negotiateConfig;
+} // namespace Negotiate
+} // namespace Auth
 
 #endif
index 8abce30fd3b9c29c7e0ce5a0f5af97a8aaeb5ab2..b39c8f3cb075ab52bdfc120e44252755c4872284 100644 (file)
@@ -66,6 +66,6 @@ Auth::Ntlm::Scheme::shutdownCleanup()
 Auth::Config *
 Auth::Ntlm::Scheme::createConfig()
 {
-    auth_ntlm_config *ntlmCfg = new auth_ntlm_config;
+    Auth::Ntlm::Config *ntlmCfg = new Auth::Ntlm::Config;
     return dynamic_cast<Auth::Config*>(ntlmCfg);
 }
index 89e91b5493927a78ddb0e3065441eb250737c1d5..ccd7e6821f5d83178f5399cabcd68f1f85a354b6 100644 (file)
@@ -79,7 +79,7 @@ AuthNTLMUserRequest::module_start(RH * handler, void *data)
 
     debugs(29, 8, HERE << "credentials state is '" << user()->credentials() << "'");
 
-    if (static_cast<AuthNTLMConfig*>(Auth::Config::Find("ntlm"))->authenticateProgram == NULL) {
+    if (static_cast<Auth::Ntlm::Config*>(Auth::Config::Find("ntlm"))->authenticateProgram == NULL) {
         debugs(29, DBG_CRITICAL, "ERROR: NTLM Start: no NTLM program configured.");
         handler(data, NULL);
         return;
index 00a9047437512349134d4a14318aa5a999e8cf30..09242e6b07c7fb44dbb3e880f2212274a730da0c 100644 (file)
@@ -66,7 +66,7 @@ static hash_table *proxy_auth_cache = NULL;
  */
 
 void
-AuthNTLMConfig::rotateHelpers()
+Auth::Ntlm::Config::rotateHelpers()
 {
     /* schedule closure of existing helpers */
     if (ntlmauthenticators) {
@@ -78,7 +78,7 @@ AuthNTLMConfig::rotateHelpers()
 
 /* free any allocated configuration details */
 void
-AuthNTLMConfig::done()
+Auth::Ntlm::Config::done()
 {
     authntlm_initialised = 0;
 
@@ -95,11 +95,11 @@ AuthNTLMConfig::done()
     if (authenticateProgram)
         wordlistDestroy(&authenticateProgram);
 
-    debugs(29, 2, "ntlmScheme::done: NTLM authentication Shutdown.");
+    debugs(29, DBG_IMPORTANT, "Reconfigure: NTLM authentication configuration cleared.");
 }
 
 void
-AuthNTLMConfig::dump(StoreEntry * entry, const char *name, Auth::Config * scheme)
+Auth::Ntlm::Config::dump(StoreEntry * entry, const char *name, Auth::Config * scheme)
 {
     wordlist *list = authenticateProgram;
     storeAppendPrintf(entry, "%s %s", name, "ntlm");
@@ -115,11 +115,11 @@ AuthNTLMConfig::dump(StoreEntry * entry, const char *name, Auth::Config * scheme
 
 }
 
-AuthNTLMConfig::AuthNTLMConfig() : keep_alive(1)
+Auth::Ntlm::Config::Config() : keep_alive(1)
 { }
 
 void
-AuthNTLMConfig::parse(Auth::Config * scheme, int n_configured, char *param_str)
+Auth::Ntlm::Config::parse(Auth::Config * scheme, int n_configured, char *param_str)
 {
     if (strcasecmp(param_str, "program") == 0) {
         if (authenticateProgram)
@@ -133,12 +133,12 @@ AuthNTLMConfig::parse(Auth::Config * scheme, int n_configured, char *param_str)
     } else if (strcasecmp(param_str, "keep_alive") == 0) {
         parse_onoff(&keep_alive);
     } else {
-        debugs(29, 0, "AuthNTLMConfig::parse: unrecognised ntlm auth scheme parameter '" << param_str << "'");
+        debugs(29, DBG_CRITICAL, "ERROR unrecognised NTLM auth scheme parameter '" << param_str << "'");
     }
 }
 
 const char *
-AuthNTLMConfig::type() const
+Auth::Ntlm::Config::type() const
 {
     return Auth::Ntlm::Scheme::GetInstance()->type();
 }
@@ -146,7 +146,7 @@ AuthNTLMConfig::type() const
 /* Initialize helpers and the like for this auth scheme. Called AFTER parsing the
  * config file */
 void
-AuthNTLMConfig::init(Auth::Config * scheme)
+Auth::Ntlm::Config::init(Auth::Config * scheme)
 {
     if (authenticateProgram) {
 
@@ -173,7 +173,7 @@ AuthNTLMConfig::init(Auth::Config * scheme)
 }
 
 void
-AuthNTLMConfig::registerWithCacheManager(void)
+Auth::Ntlm::Config::registerWithCacheManager(void)
 {
     Mgr::RegisterAction("ntlmauthenticator",
                         "NTLM User Authenticator Stats",
@@ -181,27 +181,27 @@ AuthNTLMConfig::registerWithCacheManager(void)
 }
 
 bool
-AuthNTLMConfig::active() const
+Auth::Ntlm::Config::active() const
 {
     return authntlm_initialised == 1;
 }
 
 bool
-AuthNTLMConfig::configured() const
+Auth::Ntlm::Config::configured() const
 {
     if ((authenticateProgram != NULL) && (authenticateChildren.n_max != 0)) {
-        debugs(29, 9, "AuthNTLMConfig::configured: returning configured");
+        debugs(29, 9, HERE << "returning configured");
         return true;
     }
 
-    debugs(29, 9, "AuthNTLMConfig::configured: returning unconfigured");
+    debugs(29, 9, HERE << "returning unconfigured");
     return false;
 }
 
 /* NTLM Scheme */
 
 void
-AuthNTLMConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
+Auth::Ntlm::Config::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request)
 {
     if (!authenticateProgram)
         return;
@@ -212,7 +212,7 @@ AuthNTLMConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply
 
     /* New request, no user details */
     if (auth_user_request == NULL) {
-        debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM'");
+        debugs(29, 9, HERE << "Sending type:" << hdrType << " header: 'NTLM'");
         httpHeaderPutStrf(&rep->header, hdrType, "NTLM");
 
         if (!keep_alive) {
@@ -240,19 +240,19 @@ AuthNTLMConfig::fixHeader(AuthUserRequest::Pointer auth_user_request, HttpReply
         case AuthUser::Unchecked:
             /* semantic change: do not drop the connection.
              * 2.5 implementation used to keep it open - Kinkie */
-            debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM'");
+            debugs(29, 9, HERE << "Sending type:" << hdrType << " header: 'NTLM'");
             httpHeaderPutStrf(&rep->header, hdrType, "NTLM");
             break;
 
         case AuthUser::Handshake:
             /* we're waiting for a response from the client. Pass it the blob */
-            debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM " << ntlm_request->server_blob << "'");
+            debugs(29, 9, HERE << "Sending type:" << hdrType << " header: 'NTLM " << ntlm_request->server_blob << "'");
             httpHeaderPutStrf(&rep->header, hdrType, "NTLM %s", ntlm_request->server_blob);
             safe_free(ntlm_request->server_blob);
             break;
 
         default:
-            debugs(29, DBG_CRITICAL, "AuthNTLMConfig::fixHeader: state " << ntlm_request->user()->credentials() << ".");
+            debugs(29, DBG_CRITICAL, "NTLM Auth fixHeader: state " << ntlm_request->user()->credentials() << ".");
             fatal("unexpected state in AuthenticateNTLMFixErrorHeader.\n");
         }
     }
@@ -280,7 +280,7 @@ authenticateNTLMStats(StoreEntry * sentry)
  * Auth_user structure.
  */
 AuthUserRequest::Pointer
-AuthNTLMConfig::decode(char const *proxy_auth)
+Auth::Ntlm::Config::decode(char const *proxy_auth)
 {
     NTLMUser *newUser = new NTLMUser(Auth::Config::Find("ntlm"));
     AuthUserRequest::Pointer auth_user_request = new AuthNTLMUserRequest();
@@ -290,7 +290,7 @@ AuthNTLMConfig::decode(char const *proxy_auth)
     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");
+    debugs(29, 9, HERE << "decode: NTLM authentication");
     return auth_user_request;
 }
 
index a4dee84f440e54a0a7b217e220c786c637f210dc..a5546214235e93d8ed6219226e43ee995e9aa4b0 100644 (file)
@@ -30,13 +30,14 @@ MEMPROXY_CLASS_INLINE(NTLMUser);
 
 typedef class NTLMUser ntlm_user_t;
 
-/* configuration runtime data */
+namespace Auth {
+namespace Ntlm {
 
-class AuthNTLMConfig : public Auth::Config
+/** NTLM Authentication configuration data */
+class Config : public Auth::Config
 {
-
 public:
-    AuthNTLMConfig();
+    Config();
     virtual bool active() const;
     virtual bool configured() const;
     virtual AuthUserRequest::Pointer decode(char const *proxy_auth);
@@ -48,10 +49,13 @@ public:
     virtual void parse(Auth::Config *, int, char *);
     virtual void registerWithCacheManager(void);
     virtual const char * type() const;
+
+public:
     int keep_alive;
 };
 
-typedef class AuthNTLMConfig auth_ntlm_config;
+} // namespace Ntlm
+} // namespace Auth
 
 extern statefulhelper *ntlmauthenticators;