--------------------- PatchSet 1667 Date: 2001/02/26 04:40:02 Author: rbcollins Branch: generic_modules Tag: (none) Log: API change for auth modules Members: src/Makefile.in:1.7.4.6->1.7.4.7 src/cache_cf.c:1.18.4.15->1.18.4.16 src/cf.data.pre:1.21.4.9->1.21.4.10 src/structs.h:1.24.4.11->1.24.4.12 src/typedefs.h:1.15.4.9->1.15.4.10 src/auth/basic/auth_basic.c:1.9.4.3->1.9.4.4 Index: squid/src/Makefile.in =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/Makefile.in,v retrieving revision 1.7.4.6 retrieving revision 1.7.4.7 diff -u -r1.7.4.6 -r1.7.4.7 --- squid/src/Makefile.in 15 Feb 2001 13:55:30 -0000 1.7.4.6 +++ squid/src/Makefile.in 26 Feb 2001 04:40:02 -0000 1.7.4.7 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.7.4.6 2001/02/15 13:55:30 rbcollins Exp $ +# $Id: Makefile.in,v 1.7.4.7 2001/02/26 04:40:02 rbcollins Exp $ # # Uncomment and customize the following to suit your needs: # @@ -200,7 +200,7 @@ DEFAULTS = \ -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -all: squid.conf +all: squid.conf squid.conf.old @for dir in $(SUBDIRS); do \ echo "Making $@ in $$dir..."; \ (cd $$dir ; $(MAKE) $(MFLAGS) prefix="$(prefix)" $@) || exit 1; \ @@ -249,8 +249,12 @@ cache_cf.o: cf_parser.c -squid.conf: cf_parser.c +squid.conf.old: cf_parser.c @sh -c "test -f squid.conf || ./cf_gen cf.data" + @sh -c "mv squid.conf squid.conf.old" + +squid.conf: $(SQUID_EXE) + @sh -c "./$(SQUID_EXE) -c internalonly -c all > squid.conf" cf_parser.c: cf.data cf_gen ./cf_gen cf.data Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.18.4.15 retrieving revision 1.18.4.16 diff -u -r1.18.4.15 -r1.18.4.16 --- squid/src/cache_cf.c 25 Feb 2001 14:07:59 -0000 1.18.4.15 +++ squid/src/cache_cf.c 26 Feb 2001 04:40:03 -0000 1.18.4.16 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.18.4.15 2001/02/25 14:07:59 rbcollins Exp $ + * $Id: cache_cf.c,v 1.18.4.16 2001/02/26 04:40:03 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1030,7 +1030,8 @@ } } -/* todo: remove these. The auth modules should implement the parsing themselves */ +/* todo: turn these into wordlists + * The auth modules should implement the parsing themselves */ static void parse_authparam(parserNameNode *parserName, void * data) @@ -1064,7 +1065,6 @@ scheme->Id = type; scheme->typestr = authscheme_list[type].typestr; } - authscheme_list[type].parse(parserName, scheme, config->n_configured, param_str); } static void @@ -1078,7 +1078,6 @@ return; for (i = 0; i < cfg->n_configured; i++) { scheme = cfg->schemes + i; - authscheme_list[scheme->Id].freeconfig(scheme); } safe_free(cfg->schemes); cfg->schemes = NULL; @@ -1094,7 +1093,6 @@ int i; for (i = 0; i < cfg.n_configured; i++) { scheme = cfg.schemes + i; - authscheme_list[scheme->Id].dump(entry, name, scheme); } } @@ -2746,7 +2744,7 @@ parserDeregisterAllTypes(); parserRegisterAllTypes(); parserRegisterAllNames(); - rv = mod_internal_install("all", NULL); + rv = !mod_internal_install("all", NULL); defaults_if_none(); configDoConfigure(); } Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.21.4.9 retrieving revision 1.21.4.10 diff -u -r1.21.4.9 -r1.21.4.10 --- squid/src/cf.data.pre 25 Feb 2001 21:49:10 -0000 1.21.4.9 +++ squid/src/cf.data.pre 26 Feb 2001 04:40:03 -0000 1.21.4.10 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.21.4.9 2001/02/25 21:49:10 rbcollins Exp $ +# $Id: cf.data.pre,v 1.21.4.10 2001/02/26 04:40:03 rbcollins Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1206,7 +1206,7 @@ are sent. DOC_END -NAME: auth_param +NAME: authentication_scheme TYPE: authparam LOC: Config.authConfig DEFAULT: none @@ -1879,6 +1879,10 @@ # WARNING: proxy_auth can't be used in a transparent proxy. It # collides with any authentication done by origin servers. It may # seem like it works at first, but it doesn't. + # + # NOTE: Authentication schemes need to be defined before proxy_auth ACL's + # in the squid.conf file. + # See authenticate_* commands. acl aclname snmp_community string ... # A community string to limit access to your SNMP Agent Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.24.4.11 retrieving revision 1.24.4.12 diff -u -r1.24.4.11 -r1.24.4.12 --- squid/src/structs.h 25 Feb 2001 14:07:59 -0000 1.24.4.11 +++ squid/src/structs.h 26 Feb 2001 04:40:03 -0000 1.24.4.12 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.24.4.11 2001/02/25 14:07:59 rbcollins Exp $ + * $Id: structs.h,v 1.24.4.12 2001/02/26 04:40:03 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -140,15 +140,12 @@ AUTHSAUTHED *authenticated; AUTHSAUTHUSER *authAuthenticate; AUTHSCONFIGURED *configured; - AUTHSDUMP *dump; AUTHSFIXERR *authFixHeader; AUTHSFREE *FreeUser; - AUTHSFREECONFIG *freeconfig; AUTHSUSERNAME *authUserUsername; AUTHSONCLOSEC *oncloseconnection; /*optional */ AUTHSDECODE *decodeauth; AUTHSDIRECTION *getdirection; - AUTHSPARSE *parse; AUTHSINIT *init; AUTHSREQFREE *requestFree; AUTHSSHUTDOWN *donefunc; @@ -166,8 +163,6 @@ const char *typestr; /* the scheme id in the authscheme_list */ int Id; - /* the scheme's configuration details. */ - void *scheme_data; }; struct _acl_deny_info_list { Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.15.4.9 retrieving revision 1.15.4.10 diff -u -r1.15.4.9 -r1.15.4.10 --- squid/src/typedefs.h 25 Feb 2001 14:08:00 -0000 1.15.4.9 +++ squid/src/typedefs.h 26 Feb 2001 04:40:03 -0000 1.15.4.10 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.15.4.9 2001/02/25 14:08:00 rbcollins Exp $ + * $Id: typedefs.h,v 1.15.4.10 2001/02/26 04:40:03 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -315,15 +315,12 @@ typedef int AUTHSCONFIGURED(void); typedef void AUTHSDECODE(auth_user_request_t *, const char *); typedef int AUTHSDIRECTION(auth_user_request_t *); -typedef void AUTHSDUMP(StoreEntry *, const char *, authScheme *); typedef void AUTHSFIXERR(auth_user_request_t *, HttpReply *, http_hdr_type, request_t *); typedef void AUTHSADDHEADER(auth_user_request_t *, HttpReply *, int); typedef void AUTHSADDTRAILER(auth_user_request_t *, HttpReply *, int); typedef void AUTHSFREE(auth_user_t *); -typedef void AUTHSFREECONFIG(authScheme *); typedef char *AUTHSUSERNAME(auth_user_t *); typedef void AUTHSONCLOSEC(ConnStateData *); -typedef void AUTHSPARSE(parserNameNode *, authScheme *, int, char *); typedef void AUTHSINIT(authScheme *); typedef void AUTHSREQFREE(auth_user_request_t *); typedef void AUTHSSETUP(authscheme_entry_t *); Index: squid/src/auth/basic/auth_basic.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/basic/auth_basic.c,v retrieving revision 1.9.4.3 retrieving revision 1.9.4.4 diff -u -r1.9.4.3 -r1.9.4.4 --- squid/src/auth/basic/auth_basic.c 25 Feb 2001 21:49:10 -0000 1.9.4.3 +++ squid/src/auth/basic/auth_basic.c 26 Feb 2001 04:40:04 -0000 1.9.4.4 @@ -56,11 +56,8 @@ static AUTHSCONFIGURED authBasicConfigured; static AUTHSDIRECTION authenticateBasicDirection; static AUTHSDECODE authenticateBasicDecodeAuth; -static AUTHSDUMP authBasicCfgDump; static AUTHSFIXERR authenticateBasicFixErrorHeader; static AUTHSFREE authenticateBasicFreeUser; -static AUTHSFREECONFIG authBasicFreeConfig; -static AUTHSPARSE authBasicParse; static AUTHSINIT authBasicInit; static AUTHSSTART authenticateBasicStart; static AUTHSSTATS authenticateBasicStats; @@ -142,20 +139,6 @@ "# authenticate_basic_ttl 2 hours\n\n"); } -/* config parsing - if (strcasecmp(param_str, "program") == 0) { - if (basicConfig.authenticate) - free_wordlist(parserName, &basicConfig.authenticate); - parse_wordlist(parserName, &basicConfig.authenticate); - requirePathnameExists("authparam basic program", basicConfig.authenticate->key); - } else if (strcasecmp(param_str, "children") == 0) { - parse_int(parserName, &basicConfig.authenticateChildren); - } else if (strcasecmp(param_str, "realm") == 0) { - parse_eol(parserName, &basicConfig.basicAuthRealm); - } else if (strcasecmp(param_str, "credentialsttl") == 0) { - parse_time_t(parserName, &basicConfig.credentialsTTL); -*/ - static AUTHSSETUP authSchemeSetup_basic; /* register as a module */ @@ -185,15 +168,12 @@ { assert(!authbasic_initialised); authscheme->Active = authenticateBasicActive; - authscheme->parse = authBasicParse; - authscheme->dump = authBasicCfgDump; authscheme->init = authBasicInit; authscheme->authAuthenticate = authenticateBasicAuthenticateUser; authscheme->authenticated = authenticateBasicAuthenticated; authscheme->configured = authBasicConfigured; authscheme->authFixHeader = authenticateBasicFixErrorHeader; authscheme->FreeUser = authenticateBasicFreeUser; - authscheme->freeconfig = authBasicFreeConfig; authscheme->authStart = authenticateBasicStart; authscheme->authStats = authenticateBasicStats; authscheme->authUserUsername = authenticateBasicUsername; @@ -324,21 +304,6 @@ } } -/* free any allocated configuration details */ -void -authBasicFreeConfig(authScheme * scheme) -{ -// if (basicConfig == NULL) -// return; -// assert(basicConfig == scheme->scheme_data); - if (basicConfig.authenticate) - wordlistDestroy(&basicConfig.authenticate); - if (basicConfig.basicAuthRealm) - safe_free(basicConfig.basicAuthRealm); -// xfree(basicConfig); -// basicConfig = NULL; -} - void authenticateBasicFreeUser(auth_user_t * auth_user) { @@ -395,51 +360,6 @@ } static void -authBasicCfgDump(StoreEntry * entry, const char *name, authScheme * scheme) -{ - auth_basic_config *config = scheme->scheme_data; - wordlist *list = config->authenticate; - storeAppendPrintf(entry, "%s %s", name, "basic"); - while (list != NULL) { - storeAppendPrintf(entry, " %s", list->key); - list = list->next; - } - storeAppendPrintf(entry, "\n%s %s realm %s\n%s %s children %d\n%s %s credentialsttl %d seconds\n", - name, "basic", config->basicAuthRealm, - name, "basic", config->authenticateChildren, - name, "basic", config->credentialsTTL); - -} - -static void -authBasicParse(parserNameNode *parserName, authScheme * scheme, int n_configured, char *param_str) -{ -// if (scheme->scheme_data == NULL) { -// assert(basicConfig == NULL); - /* this is the first param to be found */ -// scheme->scheme_data = xmalloc(sizeof(auth_basic_config)); -// memset(scheme->scheme_data, 0, sizeof(auth_basic_config)); -// basicConfig = scheme->scheme_data; -// basicConfig->authenticateChildren = 5; -// } -// basicConfig = scheme->scheme_data; - if (strcasecmp(param_str, "program") == 0) { - if (basicConfig.authenticate) - free_wordlist(parserName, &basicConfig.authenticate); - parse_wordlist(parserName, &basicConfig.authenticate); - requirePathnameExists("authparam basic program", basicConfig.authenticate->key); - } else if (strcasecmp(param_str, "children") == 0) { - parse_int(parserName, &basicConfig.authenticateChildren); - } else if (strcasecmp(param_str, "realm") == 0) { - parse_eol(parserName, &basicConfig.basicAuthRealm); - } else if (strcasecmp(param_str, "credentialsttl") == 0) { - parse_time_t(parserName, &basicConfig.credentialsTTL); - } else { - debug(28, 0) ("unrecognised basic auth scheme parameter '%s'\n", param_str); - } -} - -static void authenticateBasicStats(StoreEntry * sentry) { storeAppendPrintf(sentry, "Basic Authenticator Statistics:\n");