--------------------- PatchSet 1677 Date: 2001/03/01 00:31:43 Author: rbcollins Branch: generic_modules Tag: (none) Log: post parse functions implemented Members: src/cache_cf.c:1.18.4.17->1.18.4.18 src/cf_gen.c:1.7.8.10->1.7.8.11 src/protos.h:1.18.4.14->1.18.4.15 src/structs.h:1.24.4.13->1.24.4.14 src/typedefs.h:1.15.4.11->1.15.4.12 src/auth/basic/auth_basic.c:1.9.4.5->1.9.4.6 src/auth/digest/auth_digest.c:1.4.4.3->1.4.4.4 src/auth/ntlm/auth_ntlm.c:1.7.6.3->1.7.6.4 Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.18.4.17 retrieving revision 1.18.4.18 diff -u -r1.18.4.17 -r1.18.4.18 --- squid/src/cache_cf.c 26 Feb 2001 12:26:28 -0000 1.18.4.17 +++ squid/src/cache_cf.c 1 Mar 2001 00:31:43 -0000 1.18.4.18 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.18.4.17 2001/02/26 12:26:28 rbcollins Exp $ + * $Id: cache_cf.c,v 1.18.4.18 2001/03/01 00:31:43 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -57,7 +57,7 @@ static const char *const list_sep = ", \t\n\r"; static void update_maxobjsize(void); -static void configDoConfigure(void); +static int configDoConfigure(void); static PARSER_PARSE parse_refreshpattern; static int parseTimeUnits(const char *unit); static void parseTimeLine(time_t * tptr, const char *units); @@ -112,8 +112,9 @@ void parserRegisterType(const char *, PARSER_PARSE *, PARSER_FREE *, PARSER_DUMP *); void parserDeregisterType(parserTypeNode *); parserNameNode *parserNameByName(const char *name); -void parserRegisterName(const char *, parserTypeNode *, void *, PARSER_DEFAULT_NONE *, PARSER_NAME_DOCUMENT *); +void parserRegisterName(const char *, parserTypeNode *, void *, PARSER_DEFAULT_NONE *, PARSER_NAME_DOCUMENT *, PARSER_POST_PARSE *); void parserDeregisterName(parserNameNode *); +static int parserNameDoPostParse(void); static int parse_line(char *buff); static void free_all(void); @@ -293,7 +294,7 @@ parserRegisterAllNames(); err_count=parseConfigFile(file_name); defaults_if_none(); - configDoConfigure(); + err_count += configDoConfigure(); cachemgrRegister("config", "Current Squid Configuration", dump_config, @@ -301,10 +302,11 @@ return err_count; } -static void +static int configDoConfigure(void) { LOCAL_ARRAY(char, buf, BUFSIZ); + int rv=0; memset(&Config2, '\0', sizeof(SquidConfig2)); /* init memory as early as possible */ memConfigure(); @@ -461,6 +463,8 @@ Config2.effectiveGroupID = grp->gr_gid; } urlExtMethodConfigure(); + rv += parserNameDoPostParse(); + return rv; } /* Parse a time specification from the config file. Store the @@ -2582,7 +2586,7 @@ */ void parserRegisterName(const char *name, parserTypeNode *parserType, void *location, - PARSER_DEFAULT_NONE *default_none, PARSER_NAME_DOCUMENT *documentfunc) + PARSER_DEFAULT_NONE *default_none, PARSER_NAME_DOCUMENT *documentfunc, PARSER_POST_PARSE *post_parse_func) { parserNameNode *parserName; if ((parserName=parserNameByName(name))==NULL) { @@ -2597,6 +2601,7 @@ parserName->location=location; parserName->default_none=default_none; parserName->documentfunc=documentfunc; + parserName->post_parse_func=post_parse_func; dlinkAddTail(parserName,&parserName->node,&parserNames); } else { /* confirm the pointers are the same */ @@ -2604,7 +2609,8 @@ if ((parserName->type!=parserType) || (parserName->location!=location) || (parserName->default_none!=default_none) || - (parserName->documentfunc!=documentfunc)) { + (parserName->documentfunc!=documentfunc) || + (parserName->post_parse_func!=post_parse_func)) { debug(3,0)("parserRegisterName already registered name '%s' has a different type, location, default_if_none function or document function.\n",name); } } @@ -2627,6 +2633,7 @@ } } +/* TODO: we might hit a null pointer here if the node gets unlinked under us */ static void parserDeregisterAllNames(void) { @@ -2638,6 +2645,20 @@ } } +static int +parserNameDoPostParse(void) +{ + dlink_node *node; + int rv=0; + node=parserNames.head; + while (node) { + if (((parserNameNode *)node->data)->post_parse_func) + rv+=((parserNameNode *)node->data)->post_parse_func(); + node=node->next; + } + return rv; +} + void default_line(const char *s) { Index: squid/src/cf_gen.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf_gen.c,v retrieving revision 1.7.8.10 retrieving revision 1.7.8.11 diff -u -r1.7.8.10 -r1.7.8.11 --- squid/src/cf_gen.c 26 Feb 2001 12:26:28 -0000 1.7.8.10 +++ squid/src/cf_gen.c 1 Mar 2001 00:31:44 -0000 1.7.8.11 @@ -1,6 +1,6 @@ /* - * $Id: cf_gen.c,v 1.7.8.10 2001/02/26 12:26:28 rbcollins Exp $ + * $Id: cf_gen.c,v 1.7.8.11 2001/03/01 00:31:44 rbcollins Exp $ * * DEBUG: none Generate squid.conf and cf_parser.c * AUTHOR: Max Okumoto @@ -527,7 +527,7 @@ } if (entry->ifdef) fprintf(fp, "#if %s\n", entry->ifdef); - fprintf(fp, "\tparserRegisterName(\"%s\",parserTypeByName(\"%s\"),&%s%s,default_if_none_%s,name_document_%s);\n", + fprintf(fp, "\tparserRegisterName(\"%s\",parserTypeByName(\"%s\"),&%s%s,default_if_none_%s,name_document_%s, NULL);\n", entry->name, entry->type, entry->loc, Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.18.4.14 retrieving revision 1.18.4.15 diff -u -r1.18.4.14 -r1.18.4.15 --- squid/src/protos.h 26 Feb 2001 12:26:28 -0000 1.18.4.14 +++ squid/src/protos.h 1 Mar 2001 00:31:44 -0000 1.18.4.15 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.18.4.14 2001/02/26 12:26:28 rbcollins Exp $ + * $Id: protos.h,v 1.18.4.15 2001/03/01 00:31:44 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -104,7 +104,7 @@ extern void parserDeregisterType(parserTypeNode *); extern parserTypeNode *parserTypeByName(const char *); /* name, type */ -extern void parserRegisterName(const char *, parserTypeNode *, void *, PARSER_DEFAULT_NONE *, PARSER_NAME_DOCUMENT *); +extern void parserRegisterName(const char *, parserTypeNode *, void *, PARSER_DEFAULT_NONE *, PARSER_NAME_DOCUMENT *, PARSER_POST_PARSE *); extern void parserDeregisterName(parserNameNode *); extern parserNameNode *parserNameByName(const char *); Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.24.4.13 retrieving revision 1.24.4.14 diff -u -r1.24.4.13 -r1.24.4.14 --- squid/src/structs.h 26 Feb 2001 12:26:28 -0000 1.24.4.13 +++ squid/src/structs.h 1 Mar 2001 00:31:44 -0000 1.24.4.14 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.24.4.13 2001/02/26 12:26:28 rbcollins Exp $ + * $Id: structs.h,v 1.24.4.14 2001/03/01 00:31:44 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -316,6 +316,7 @@ parserTypeNode *type; PARSER_DEFAULT_NONE *default_none; PARSER_NAME_DOCUMENT *documentfunc; + PARSER_POST_PARSE *post_parse_func; void *location; struct { unsigned int registered:1; Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.15.4.11 retrieving revision 1.15.4.12 diff -u -r1.15.4.11 -r1.15.4.12 --- squid/src/typedefs.h 26 Feb 2001 12:26:29 -0000 1.15.4.11 +++ squid/src/typedefs.h 1 Mar 2001 00:31:44 -0000 1.15.4.12 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.15.4.11 2001/02/26 12:26:29 rbcollins Exp $ + * $Id: typedefs.h,v 1.15.4.12 2001/03/01 00:31:44 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -209,6 +209,7 @@ typedef void PARSER_DUMP (StoreEntry *, const char *, void const *const); typedef void PARSER_DEFAULT_NONE(void *); typedef void PARSER_NAME_DOCUMENT(void); +typedef int PARSER_POST_PARSE(void); #if SQUID_SNMP typedef variable_list *(oid_ParseFn) (variable_list *, snint *); 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.5 retrieving revision 1.9.4.6 diff -u -r1.9.4.5 -r1.9.4.6 --- squid/src/auth/basic/auth_basic.c 26 Feb 2001 12:26:29 -0000 1.9.4.5 +++ squid/src/auth/basic/auth_basic.c 1 Mar 2001 00:31:45 -0000 1.9.4.6 @@ -146,12 +146,12 @@ mod_install_basic (const char *namestr) { authSchemeAdd(namestr, authSchemeSetup_basic); - parserRegisterName("authenticate_basic_program", parserTypeByName("wordlist"), &basicConfig.authenticate, NULL, authBasicDocumentProgram); - parserRegisterName("authenticate_basic_children", parserTypeByName("int"), &basicConfig.authenticateChildren, NULL, authBasicDocumentChildren); + parserRegisterName("authenticate_basic_program", parserTypeByName("wordlist"), &basicConfig.authenticate, NULL, authBasicDocumentProgram, NULL); + parserRegisterName("authenticate_basic_children", parserTypeByName("int"), &basicConfig.authenticateChildren, NULL, authBasicDocumentChildren, NULL); default_line("authenticate_basic_children 5"); - parserRegisterName("authenticate_basic_realm", parserTypeByName("eol"), &basicConfig.basicAuthRealm, NULL, authBasicDocumentRealm); + parserRegisterName("authenticate_basic_realm", parserTypeByName("eol"), &basicConfig.basicAuthRealm, NULL, authBasicDocumentRealm, NULL); default_line("authenticate_basic_realm Squid proxy-caching web server"); - parserRegisterName("authenticate_basic_ttl", parserTypeByName("time_t"), &basicConfig.credentialsTTL, NULL, authBasicDocumentTTL); + parserRegisterName("authenticate_basic_ttl", parserTypeByName("time_t"), &basicConfig.credentialsTTL, NULL, authBasicDocumentTTL, NULL); default_line("authenticate_basic_ttl 2 hours"); /* until we support mod_uninstall we need to keep the names active indefinately */ Index: squid/src/auth/digest/auth_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/digest/auth_digest.c,v retrieving revision 1.4.4.3 retrieving revision 1.4.4.4 diff -u -r1.4.4.3 -r1.4.4.4 --- squid/src/auth/digest/auth_digest.c 26 Feb 2001 12:26:30 -0000 1.4.4.3 +++ squid/src/auth/digest/auth_digest.c 1 Mar 2001 00:31:45 -0000 1.4.4.4 @@ -633,12 +633,12 @@ mod_install_digest (const char *namestr) { authSchemeAdd(namestr, authSchemeSetup_digest); - parserRegisterName("authenticate_digest_program", parserTypeByName("wordlist"), &digestConfig.authenticate, NULL, authDigestDocumentProgram); - parserRegisterName("authenticate_digest_children", parserTypeByName("int"), &digestConfig.authenticateChildren, NULL, authBasicDocumentChildren); - parserRegisterName("authenticate_digest_realm", parserTypeByName("eol"), &digestConfig.digestAuthRealm, NULL, authBasicDocumentRealm); - parserRegisterName("authenticate_digest_nonce_garbage_interval", parserTypeByName("time_t"), &digestConfig.nonceGCInterval, NULL, authBasicDocumentGCInterval); - parserRegisterName("authenticate_digest_nonce_max_duration", parserTypeByName("time_t"), &digestConfig.noncemaxduration, NULL, authBasicDocumentNonceDuration); - parserRegisterName("authenticate_digest_nonce_max_count", parserTypeByName("int"), &digestConfig.noncemaxuses, NULL, authBasicDocumentNonceCount); + parserRegisterName("authenticate_digest_program", parserTypeByName("wordlist"), &digestConfig.authenticate, NULL, authDigestDocumentProgram, NULL); + parserRegisterName("authenticate_digest_children", parserTypeByName("int"), &digestConfig.authenticateChildren, NULL, authBasicDocumentChildren, NULL); + parserRegisterName("authenticate_digest_realm", parserTypeByName("eol"), &digestConfig.digestAuthRealm, NULL, authBasicDocumentRealm, NULL); + parserRegisterName("authenticate_digest_nonce_garbage_interval", parserTypeByName("time_t"), &digestConfig.nonceGCInterval, NULL, authBasicDocumentGCInterval, NULL); + parserRegisterName("authenticate_digest_nonce_max_duration", parserTypeByName("time_t"), &digestConfig.noncemaxduration, NULL, authBasicDocumentNonceDuration, NULL); + parserRegisterName("authenticate_digest_nonce_max_count", parserTypeByName("int"), &digestConfig.noncemaxuses, NULL, authBasicDocumentNonceCount, NULL); /* until we support mod_uninstall we need to keep the names active indefinately */ cbdataLock(parserNameByName("authenticate_digest_program")); Index: squid/src/auth/ntlm/auth_ntlm.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/ntlm/auth_ntlm.c,v retrieving revision 1.7.6.3 retrieving revision 1.7.6.4 diff -u -r1.7.6.3 -r1.7.6.4 --- squid/src/auth/ntlm/auth_ntlm.c 26 Feb 2001 12:26:30 -0000 1.7.6.3 +++ squid/src/auth/ntlm/auth_ntlm.c 1 Mar 2001 00:31:45 -0000 1.7.6.4 @@ -148,12 +148,12 @@ mod_install_ntlm (const char *namestr) { authSchemeAdd(namestr, authSchemeSetup_ntlm); - parserRegisterName("authenticate_ntlm_program", parserTypeByName("wordlist"), &ntlmConfig.authenticate, NULL, authNTLMDocumentProgram); - parserRegisterName("authenticate_ntlm_children", parserTypeByName("int"), &ntlmConfig.authenticateChildren, NULL, authNTLMDocumentChildren); + parserRegisterName("authenticate_ntlm_program", parserTypeByName("wordlist"), &ntlmConfig.authenticate, NULL, authNTLMDocumentProgram, NULL); + parserRegisterName("authenticate_ntlm_children", parserTypeByName("int"), &ntlmConfig.authenticateChildren, NULL, authNTLMDocumentChildren, NULL); default_line("authenticate_ntlm_children 5"); - parserRegisterName("authenticate_ntlm_max_challenge_reuses", parserTypeByName("int"), &ntlmConfig.challengeuses, NULL, authNTLMDocumentChallengeUses); + parserRegisterName("authenticate_ntlm_max_challenge_reuses", parserTypeByName("int"), &ntlmConfig.challengeuses, NULL, authNTLMDocumentChallengeUses, NULL); default_line("authenticate_ntlm_max_challenge_reuses 0"); - parserRegisterName("authenticate_ntlm_max_challenge_lifetime", parserTypeByName("time_t"), &ntlmConfig.challengelifetime, NULL, authNTLMDocumentChallengeLifetime); + parserRegisterName("authenticate_ntlm_max_challenge_lifetime", parserTypeByName("time_t"), &ntlmConfig.challengelifetime, NULL, authNTLMDocumentChallengeLifetime, NULL); default_line("authenticate_ntlm_max_challenge_lifetime 2 minutes"); /* until we support mod_uninstall we need to keep the names active indefinately */