--------------------- PatchSet 1361 Date: 2001/01/23 13:12:59 Author: rbcollins Branch: auth_rewrite Tag: (none) Log: on reconfigure, disable existing configured auth schemes if no longer configured validly. Members: src/authenticate.c:1.1.1.3.12.17.2.32->1.1.1.3.12.17.2.33 src/structs.h:1.1.1.3.4.1.2.26.2.31->1.1.1.3.4.1.2.26.2.32 src/typedefs.h:1.1.1.3.12.13.2.24->1.1.1.3.12.13.2.25 src/auth/basic/auth_basic.c:1.1.2.28->1.1.2.29 src/auth/ntlm/auth_ntlm.c:1.1.2.28->1.1.2.29 Index: squid/src/authenticate.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/authenticate.c,v retrieving revision 1.1.1.3.12.17.2.32 retrieving revision 1.1.1.3.12.17.2.33 diff -u -r1.1.1.3.12.17.2.32 -r1.1.1.3.12.17.2.33 --- squid/src/authenticate.c 23 Jan 2001 10:14:19 -0000 1.1.1.3.12.17.2.32 +++ squid/src/authenticate.c 23 Jan 2001 13:12:59 -0000 1.1.1.3.12.17.2.33 @@ -1,6 +1,6 @@ /* - * $Id: authenticate.c,v 1.1.1.3.12.17.2.32 2001/01/23 10:14:19 rbcollins Exp $ + * $Id: authenticate.c,v 1.1.1.3.12.17.2.33 2001/01/23 13:12:59 rbcollins Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -61,7 +61,8 @@ int i; for (i = 0; i < Config.authConfig.n_configured; i++) { scheme = Config.authConfig.schemes + i; - if (strncasecmp(proxy_auth, scheme->typestr, strlen(scheme->typestr)) == 0) + if ((strncasecmp(proxy_auth, scheme->typestr, strlen(scheme->typestr)) == 0) && + (authscheme_list[scheme->Id].Active())) return 1; } return 0; @@ -349,7 +350,7 @@ { int i = 0, rv = 0; for (i = 0; authscheme_list && authscheme_list[i].typestr; i++) - if (authscheme_list[i].Active()) + if (authscheme_list[i].configured()) rv++; debug(29, 9) ("authenticateActiveSchemeCount: %d active.\n", rv); return rv; @@ -378,7 +379,7 @@ authScheme *scheme; for (i = 0; i < config->n_configured; i++) { scheme = config->schemes + i; - if (authscheme_list[scheme->Id].init) { + if (authscheme_list[scheme->Id].init && authscheme_list[scheme->Id].configured()) { authscheme_list[scheme->Id].init(scheme); } } @@ -436,7 +437,7 @@ else { int i; authScheme *scheme; - /* call each configured authscheme */ + /* call each configured & running authscheme */ for (i = 0; i < Config.authConfig.n_configured; i++) { scheme = Config.authConfig.schemes + i; if (authscheme_list[scheme->Id].Active()) Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.1.1.3.4.1.2.26.2.31 retrieving revision 1.1.1.3.4.1.2.26.2.32 diff -u -r1.1.1.3.4.1.2.26.2.31 -r1.1.1.3.4.1.2.26.2.32 --- squid/src/structs.h 23 Jan 2001 10:14:21 -0000 1.1.1.3.4.1.2.26.2.31 +++ squid/src/structs.h 23 Jan 2001 13:12:59 -0000 1.1.1.3.4.1.2.26.2.32 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.1.1.3.4.1.2.26.2.31 2001/01/23 10:14:21 rbcollins Exp $ + * $Id: structs.h,v 1.1.1.3.4.1.2.26.2.32 2001/01/23 13:12:59 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -139,6 +139,7 @@ AUTHSADDTRAILER *AddTrailer; AUTHSAUTHED *authenticated; AUTHSAUTHUSER *authAuthenticate; + AUTHSCONFIGURED *configured; AUTHSDUMP *dump; AUTHSFIXERR *authFixHeader; AUTHSFREE *FreeUser; Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.1.1.3.12.13.2.24 retrieving revision 1.1.1.3.12.13.2.25 diff -u -r1.1.1.3.12.13.2.24 -r1.1.1.3.12.13.2.25 --- squid/src/typedefs.h 23 Jan 2001 10:14:22 -0000 1.1.1.3.12.13.2.24 +++ squid/src/typedefs.h 23 Jan 2001 13:12:59 -0000 1.1.1.3.12.13.2.25 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.1.1.3.12.13.2.24 2001/01/23 10:14:22 rbcollins Exp $ + * $Id: typedefs.h,v 1.1.1.3.12.13.2.25 2001/01/23 13:12:59 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -293,6 +293,7 @@ typedef int AUTHSACTIVE(); typedef int AUTHSAUTHED(auth_user_request_t *); typedef void AUTHSAUTHUSER(auth_user_request_t *, request_t *, ConnStateData *, http_hdr_type); +typedef int AUTHSCONFIGURED(); typedef void AUTHSDECODE(auth_user_request_t *, const char *); typedef int AUTHSDIRECTION(auth_user_request_t *); typedef void AUTHSDUMP(StoreEntry *, const char *, authScheme *); Index: squid/src/auth/basic/auth_basic.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/basic/auth_basic.c,v retrieving revision 1.1.2.28 retrieving revision 1.1.2.29 diff -u -r1.1.2.28 -r1.1.2.29 --- squid/src/auth/basic/auth_basic.c 23 Jan 2001 10:14:22 -0000 1.1.2.28 +++ squid/src/auth/basic/auth_basic.c 23 Jan 2001 13:12:59 -0000 1.1.2.29 @@ -53,6 +53,7 @@ static AUTHSACTIVE authenticateBasicActive; static AUTHSAUTHED authenticateBasicAuthenticated; static AUTHSAUTHUSER authenticateBasicAuthenticateUser; +static AUTHSCONFIGURED authBasicConfigured; static AUTHSDIRECTION authenticateBasicDirection; static AUTHSDECODE authenticateBasicDecodeAuth; static AUTHSDUMP authBasicCfgDump; @@ -107,6 +108,7 @@ authscheme->init = authBasicInit; authscheme->authAuthenticate = authenticateBasicAuthenticateUser; authscheme->authenticated = authenticateBasicAuthenticated; + authscheme->configured = authBasicConfigured; authscheme->authFixHeader = authenticateBasicFixErrorHeader; authscheme->FreeUser = authenticateBasicFreeUser; authscheme->freeconfig = authBasicFreeConfig; @@ -122,6 +124,12 @@ int authenticateBasicActive() { + return (authbasic_initialised==1) ? 1:0; +} + +int +authBasicConfigured() +{ if ((basicConfig != NULL) && (basicConfig->authenticate != NULL) && (basicConfig->authenticateChildren != 0) && (basicConfig->basicAuthRealm != NULL)) return 1; Index: squid/src/auth/ntlm/auth_ntlm.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/ntlm/auth_ntlm.c,v retrieving revision 1.1.2.28 retrieving revision 1.1.2.29 diff -u -r1.1.2.28 -r1.1.2.29 --- squid/src/auth/ntlm/auth_ntlm.c 23 Jan 2001 10:14:23 -0000 1.1.2.28 +++ squid/src/auth/ntlm/auth_ntlm.c 23 Jan 2001 13:12:59 -0000 1.1.2.29 @@ -53,6 +53,7 @@ static AUTHSACTIVE authenticateNTLMActive; static AUTHSAUTHED authNTLMAuthenticated; static AUTHSAUTHUSER authenticateNTLMAuthenticateUser; +static AUTHSCONFIGURED authNTLMConfigured; static AUTHSFIXERR authenticateNTLMFixErrorHeader; static AUTHSFREE authenticateNTLMFreeUser; static AUTHSDIRECTION authenticateNTLMDirection; @@ -94,6 +95,7 @@ void authNTLMDone(void) { + debug(29,2) ("authNTLMDone: shutting down NTLM authentication.\n"); if (ntlmauthenticators) helperStatefulShutdown(ntlmauthenticators); authntlm_initialised = 0; @@ -184,6 +186,7 @@ { assert(!authntlm_initialised); authscheme->Active = authenticateNTLMActive; + authscheme->configured = authNTLMConfigured; authscheme->parse = authNTLMParse; authscheme->dump = authNTLMCfgDump; authscheme->requestFree = authNTLMAURequestFree; @@ -243,6 +246,13 @@ int authenticateNTLMActive() { + return (authntlm_initialised==1) ? 1 : 0; +} + + +int +authNTLMConfigured() +{ if ((ntlmConfig != NULL) && (ntlmConfig->authenticate != NULL) && (ntlmConfig->authenticateChildren != 0) && (ntlmConfig->challengeuses > -1) && (ntlmConfig->challengelifetime > -1))