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.
Auth::Config *
Auth::Basic::Scheme::createConfig()
{
- AuthBasicConfig *newCfg = new AuthBasicConfig;
+ Auth::Basic::Config *newCfg = new Auth::Basic::Config;
return dynamic_cast<Auth::Config*>(newCfg);
}
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;
}
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;
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;
/* 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)) {
}
const char *
-AuthBasicConfig::type() const
+Auth::Basic::Config::type() const
{
return Auth::Basic::Scheme::GetInstance()->type();
}
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);
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.");
}
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 << "\"'");
}
void
-AuthBasicConfig::rotateHelpers()
+Auth::Basic::Config::rotateHelpers()
{
/* schedule closure of existing helpers */
if (basicauthenticators) {
/** shutdown the auth helpers and free any allocated configuration details */
void
-AuthBasicConfig::done()
+Auth::Basic::Config::done()
{
authbasic_initialised = 0;
}
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");
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)
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)
{}
char *
-AuthBasicConfig::decodeCleartext(const char *httpAuthHeader)
+Auth::Basic::Config::decodeCleartext(const char *httpAuthHeader)
{
const char *proxy_auth = httpAuthHeader;
* 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 */
/** 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;
}
void
-AuthBasicConfig::registerWithCacheManager(void)
+Auth::Basic::Config::registerWithCacheManager(void)
{
Mgr::RegisterAction("basicauthenticator",
"Basic User Authenticator Stats",
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));
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);
void decode(char const *httpAuthHeader, AuthUserRequest::Pointer);
virtual void registerWithCacheManager(void);
virtual const char * type() const;
+
+public:
char *basicAuthRealm;
time_t credentialsTTL;
int casesensitive;
char * decodeCleartext(const char *httpAuthHeader);
};
+} // namespace Basic
+} // namespace Auth
+
#endif /* __AUTH_BASIC_H__ */
Auth::Config *
Auth::Digest::Scheme::createConfig()
{
- AuthDigestConfig *digestCfg = new AuthDigestConfig;
+ Auth::Digest::Config *digestCfg = new Auth::Digest::Config;
return dynamic_cast<Auth::Config*>(digestCfg);
}
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
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));
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));
}
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;
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);
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);
}
}
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
}
/* 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;
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;
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;
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;
}
}
void
-AuthDigestConfig::rotateHelpers()
+Auth::Digest::Config::rotateHelpers()
{
/* schedule closure of existing helpers */
if (digestauthenticators) {
}
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");
}
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) &&
/* 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;
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);
}
/* 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);
}
void
-AuthDigestConfig::registerWithCacheManager(void)
+Auth::Digest::Config::registerWithCacheManager(void)
{
Mgr::RegisterAction("digestauthenticator",
"Digest User Authenticator Stats",
/* free any allocated configuration details */
void
-AuthDigestConfig::done()
+Auth::Digest::Config::done()
{
authdigest_initialised = 0;
safe_free(digestAuthRealm);
}
-AuthDigestConfig::AuthDigestConfig()
+Auth::Digest::Config::Config()
{
/* TODO: move into initialisation list */
/* 5 minutes */
}
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)
}
const char *
-AuthDigestConfig::type() const
+Auth::Digest::Config::type() const
{
return Auth::Digest::Scheme::GetInstance()->type();
}
/* 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 */
* 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;
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);
int utf8;
};
-typedef class AuthDigestConfig auth_digest_config;
+} // namespace Digest
+} // namespace Auth
/* strings */
#define QOP_AUTH "auth"
Auth::Config *
Auth::Negotiate::Scheme::createConfig()
{
- AuthNegotiateConfig *negotiateCfg = new AuthNegotiateConfig;
+ Auth::Negotiate::Config *negotiateCfg = new Auth::Negotiate::Config;
return dynamic_cast<Auth::Config*>(negotiateCfg);
}
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;
static int authnegotiate_initialised = 0;
/// \ingroup AuthNegotiateInternal
-AuthNegotiateConfig negotiateConfig;
+Auth::Negotiate::Config negotiateConfig;
/// \ingroup AuthNegotiateInternal
static hash_table *proxy_auth_cache = NULL;
*/
void
-AuthNegotiateConfig::rotateHelpers()
+Auth::Negotiate::Config::rotateHelpers()
{
/* schedule closure of existing helpers */
if (negotiateauthenticators) {
}
void
-AuthNegotiateConfig::done()
+Auth::Negotiate::Config::done()
{
authnegotiate_initialised = 0;
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");
}
-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)
} 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();
}
* Called AFTER parsing the config file
*/
void
-AuthNegotiateConfig::init(Auth::Config * scheme)
+Auth::Negotiate::Config::init(Auth::Config * scheme)
{
if (authenticateProgram) {
}
void
-AuthNegotiateConfig::registerWithCacheManager(void)
+Auth::Negotiate::Config::registerWithCacheManager(void)
{
Mgr::RegisterAction("negotiateauthenticator",
"Negotiate User Authenticator Stats",
}
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;
/* 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) {
* 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;
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");
}
}
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
* 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();
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;
}
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);
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
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);
}
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;
*/
void
-AuthNTLMConfig::rotateHelpers()
+Auth::Ntlm::Config::rotateHelpers()
{
/* schedule closure of existing helpers */
if (ntlmauthenticators) {
/* free any allocated configuration details */
void
-AuthNTLMConfig::done()
+Auth::Ntlm::Config::done()
{
authntlm_initialised = 0;
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");
}
-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)
} 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();
}
/* 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) {
}
void
-AuthNTLMConfig::registerWithCacheManager(void)
+Auth::Ntlm::Config::registerWithCacheManager(void)
{
Mgr::RegisterAction("ntlmauthenticator",
"NTLM User Authenticator Stats",
}
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;
/* 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) {
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");
}
}
* 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();
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;
}
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);
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;