--------------------- PatchSet 1712 Date: 2001/03/11 21:43:09 Author: rbcollins Branch: generic_modules Tag: (none) Log: work in progress - dynamic acl types Members: src/acl.c:1.21.4.1->1.21.4.2 src/cache_cf.c:1.18.4.18->1.18.4.19 src/cf.data.pre:1.21.4.11->1.21.4.12 src/cf_gen.c:1.7.8.11->1.7.8.12 src/protos.h:1.18.4.15->1.18.4.16 src/structs.h:1.24.4.14->1.24.4.15 src/auth/basic/auth_basic.c:1.9.4.6->1.9.4.7 src/auth/digest/auth_digest.c:1.4.4.4->1.4.4.5 src/auth/ntlm/auth_ntlm.c:1.7.6.4->1.7.6.5 Index: squid/src/acl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/acl.c,v retrieving revision 1.21.4.1 retrieving revision 1.21.4.2 diff -u -r1.21.4.1 -r1.21.4.2 --- squid/src/acl.c 21 Feb 2001 10:29:40 -0000 1.21.4.1 +++ squid/src/acl.c 11 Mar 2001 21:43:09 -0000 1.21.4.2 @@ -1,6 +1,6 @@ /* - * $Id: acl.c,v 1.21.4.1 2001/02/21 10:29:40 rbcollins Exp $ + * $Id: acl.c,v 1.21.4.2 2001/03/11 21:43:09 rbcollins Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -712,15 +712,18 @@ } void -aclParseAclLine(acl ** head) +aclParseAclLine(parserNameNode *parserName, void *data) { + acl ** head=(acl **)data; + /* we're already using strtok() to grok the line */ char *t = NULL; acl *A = NULL; - LOCAL_ARRAY(char, aclname, ACL_NAME_SZ); +// LOCAL_ARRAY(char, aclname, ACL_NAME_SZ); squid_acl acltype; int new_acl = 0; +#if NEVER /* snarf the ACL name */ if ((t = strtok(NULL, w_space)) == NULL) { debug(28, 0) ("%s line %d: %s\n", @@ -729,6 +732,7 @@ return; } xstrncpy(aclname, t, ACL_NAME_SZ); +#endif /* snarf the ACL type */ if ((t = strtok(NULL, w_space)) == NULL) { debug(28, 0) ("%s line %d: %s\n", @@ -742,6 +746,7 @@ debug(28, 0) ("aclParseAclLine: Invalid ACL type '%s'\n", t); return; } +#if NEVER if ((A = aclFindByName(aclname)) == NULL) { debug(28, 3) ("aclParseAclLine: Creating ACL '%s'\n", aclname); A = memAllocate(MEM_ACL); @@ -749,19 +754,28 @@ A->type = acltype; A->cfgline = xstrdup(config_input_line); new_acl = 1; + } else +#endif + if ((A=*head)==NULL) { + debug(28, 3) ("aclParseAclLine: Creating new ACL\n"); + A = memAllocate(MEM_ACL); + xstrncpy(A->name, parserName->namestr, ACL_NAME_SZ); + A->type = acltype; + A->cfgline = xstrdup(config_input_line); + new_acl = 1; } else { if (acltype != A->type) { debug(28, 0) ("aclParseAclLine: ACL '%s' already exists with different type, skipping.\n", A->name); return; } - debug(28, 3) ("aclParseAclLine: Appending to '%s'\n", aclname); + debug(28, 3) ("aclParseAclLine: Appending to acl \n"); new_acl = 0; } /* * Here we set AclMatchedName in case we need to use it in a * warning message in aclDomainCompare(). */ - AclMatchedName = aclname; /* ugly */ +// AclMatchedName = aclname; /* ugly */ switch (A->type) { case ACL_SRC_IP: case ACL_DST_IP: @@ -2832,3 +2846,174 @@ /* ==== END ARP ACL SUPPORT =============================================== */ #endif /* USE_ARP_ACL */ + +/* === CONFIG SUPPORT ROUTINES === */ + +static int +check_null_acl(acl * a) +{ + return a == NULL; +} +/* temp home to test with */ +static void +default_if_none_acl(void * data){ + if (check_null_acl(Config.aclList)) { + default_line("acl all src 0.0.0.0/0.0.0.0"); + } +} + +//parserRegisterType("acl",parse_acl,free_acl,dump_acl); + +static void +name_document_acl(void){ + printf( +"\n" +"# ACCESS CONTROLS\n" +"# -----------------------------------------------------------------------------\n" +"\n" +"# TAG: acl" +"\n" +"#\tDefining an Access List\n" +"#\n" +"#\tacl aclname acltype string1 ...\n" +"#\tacl aclname acltype \"file\" ...\n" +"#\n" +"#\twhen using \"file\", the file should contain one item per line\n" +"#\n" +"#\tacltype is one of src dst srcdomain dstdomain url_pattern\n" +"#\t\turlpath_pattern time port proto method browser user\n" +"#\n" +"#\tBy default, regular expressions are CASE-SENSITIVE. To make\n" +"#\tthem case-insensitive, use the -i option.\n" +"#\n" +"#\tacl aclname src ip-address/netmask ... (clients IP address)\n" +"#\tacl aclname src addr1-addr2/netmask ... (range of addresses)\n" +"#\tacl aclname dst ip-address/netmask ... (URL host's IP address)\n" +"#\tacl aclname myip ip-address/netmask ... (local socket IP address)\n" +"#\n" +"#\tacl aclname srcdomain .foo.com ... # reverse lookup, client IP\n" +"#\tacl aclname dstdomain .foo.com ... # Destination server from URL\n" +"#\tacl aclname srcdom_regex [-i] xxx ... # regex matching client name\n" +"#\tacl aclname dstdom_regex [-i] xxx ... # regex matching server\n" +"#\t # For dstdomain and dstdom_regex a reverse lookup is tried if a IP\n" +"#\t # based URL is used. The name \"none\" is used if the reverse lookup\n" +"#\t # fails.\n" +"#\n" +"#\tacl aclname time [day-abbrevs] [h1:m1-h2:m2]\n" +"#\t day-abbrevs:\n" +"#\t\tS - Sunday\n" +"#\t\tM - Monday\n" +"#\t\tT - Tuesday\n" +"#\t\tW - Wednesday\n" +"#\t\tH - Thursday\n" +"#\t\tF - Friday\n" +"#\t\tA - Saturday\n" +"#\t h1:m1 must be less than h2:m2\n" +"#\tacl aclname url_regex [-i] ^http:// ...\t# regex matching on whole URL\n" +"#\tacl aclname urlpath_regex [-i] \\.gif$ ...\t# regex matching on URL path\n" +"#\tacl aclname port 80 70 21 ...\n" +"#\tacl aclname port 0-1024 ...\t\t# ranges allowed\n" +"#\tacl aclname myport 3128 ...\t\t# (local socket TCP port)\n" +"#\tacl aclname proto HTTP FTP ...\n" +"#\tacl aclname method GET POST ...\n" +"#\tacl aclname browser [-i] regexp\n" +"#\t # pattern match on User-Agent header\n" +"#\tacl aclname ident username ...\n" +"#\tacl aclname ident_regex [-i] pattern ...\n" +"#\t # string match on ident output.\n" +"#\t # use REQUIRED to accept any non-null ident.\n" +"#\tacl aclname src_as number ... \n" +"#\tacl aclname dst_as number ...\n" +"#\t # Except for access control, AS numbers can be used for\n" +"#\t # routing of requests to specific caches. Here's an \n" +"#\t # example for routing all requests for AS#1241 and only \n" +"#\t # those to mycache.mydomain.net:\n" +"#\t # acl asexample dst_as 1241\n" +"#\t # cache_peer_access mycache.mydomain.net allow asexample\n" +"#\t # cache_peer_access mycache_mydomain.net deny all\n" +"#\n" +"#\tacl aclname proxy_auth username ...\n" +"#\tacl aclname proxy_auth_regex [-i] pattern ...\n" +"#\t # list of valid usernames\n" +"#\t # use REQUIRED to accept any valid username.\n" +"#\t #\n" +"#\t # NOTE: when a Proxy-Authentication header is sent but it is not\n" +"#\t # needed during ACL checking the username is NOT logged\n" +"#\t # in access.log.\n" +"#\t #\n" +"#\t # NOTE: proxy_auth requires a EXTERNAL authentication program\n" +"#\t # to check username/password combinations (see\n" +"#\t # authenticate_program).\n" +"#\t #\n" +"#\t # WARNING: proxy_auth can't be used in a transparent proxy. It\n" +"#\t # collides with any authentication done by origin servers. It may\n" +"#\t # seem like it works at first, but it doesn't.\n" +"#\t #\n" +"#\t # NOTE: Authentication schemes need to be defined before proxy_auth ACL's \n" +"#\t # in the squid.conf file.\n" +"#\t # See authenticate_* commands.\n" +"#\n" +"#\tacl aclname snmp_community string ...\n" +"#\t # A community string to limit access to your SNMP Agent\n" +"#\t # Example:\n" +"#\t # \n" +"#\t #\tacl snmppublic snmp_community public\n" +"#\n" +"#\tacl aclname maxconn number\n" +"#\t # This will be matched when the client's IP address has\n" +"#\t # more than HTTP connections established.\n" +"#\n" +"#\tacl req_mime_type mime-type1 ...\n" +"#\t # regex match agains the mime type of the request generated\n" +"#\t # by the client. Can be used to detect file upload or some\n" +"#\t # types HTTP tunelling requests.\n" +"#\t # NOTE: This does NOT match the reply. You cannot use this\n" +"#\t # to match the returned file type.\n" +"#\n" +"#\tacl rep_mime_type mime-type1 ...\n" +"#\t # regex match against the mime type of the reply recieved by\n" +"#\t # squid. Can be used to detect file download or some\n" +"#\t # types HTTP tunelling requests.\n" +"#\t # NOTE: This has no effect in http_access rules. It only has\n" +"#\t # effect in rules that affect the reply data stream such as\n" +"#\t # http_reply_access.\n" +"#\n" +"#\n" +"#Examples:\n" +"#acl myexample dst_as 1241\n" +"#acl password proxy_auth REQUIRED\n" +"#acl fileupload req_mime_type -i ^multipart/form-data$\n" +"#acl javascript rep_mime_type -i ^application/x-javascript$\n" +"#\n" +"#Default:\n" +"# acl all src 0.0.0.0/0.0.0.0\n" +"#\n" +"#Recommended minimum configuration:\n" +"acl all src 0.0.0.0/0.0.0.0\n" +"acl manager proto cache_object\n" +"acl localhost src 127.0.0.1/255.255.255.255\n" +"acl SSL_ports port 443 563\n" +"acl Safe_ports port 80\t\t# http\n" +"acl Safe_ports port 21\t\t# ftp\n" +"acl Safe_ports port 443 563\t# https, snews\n" +"acl Safe_ports port 70\t\t# gopher\n" +"acl Safe_ports port 210\t\t# wais\n" +"acl Safe_ports port 1025-65535\t# unregistered ports\n" +"acl Safe_ports port 280\t\t# http-mgmt\n" +"acl Safe_ports port 488\t\t# gss-http\n" +"acl Safe_ports port 591\t\t# filemaker\n" +"acl Safe_ports port 777\t\t# multiling http\n" +"acl CONNECT method CONNECT\n" +"\n" + );} + + + + +void +aclRegisterAclDirective(void) +{ + +// parserRegisterName("acl",parserTypeByName("instance_node"),&Config.aclList2,default_if_none_acl,name_document_acl, NULL); +// parserRegisterInstanceType(" +} Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.18.4.18 retrieving revision 1.18.4.19 diff -u -r1.18.4.18 -r1.18.4.19 --- squid/src/cache_cf.c 1 Mar 2001 00:31:43 -0000 1.18.4.18 +++ squid/src/cache_cf.c 11 Mar 2001 21:43:09 -0000 1.18.4.19 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.18.4.18 2001/03/01 00:31:43 rbcollins Exp $ + * $Id: cache_cf.c,v 1.18.4.19 2001/03/11 21:43:09 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -71,8 +71,10 @@ static size_t parseBytesUnits(const char *unit); static void free_all(void); static void parserRegisterAllTypes(void); +static void parserRegisterCFTypes(void); static void parserDeregisterAllTypes(void); static void parserRegisterAllNames(void); +static void parserRegisterCFNames(void); static void parserDeregisterAllNames(void); void requirePathnameExists(const char *name, const char *path); static OBJH dump_config; @@ -90,6 +92,15 @@ static PARSER_FREE free_sockaddr_in_list; static int check_null_sockaddr_in_list(const sockaddr_in_list *); +/* create instances */ +static PARSER_PARSE parse_instance_node; +static PARSER_FREE free_instance_node; +static PARSER_DUMP dump_instance_node; +/* refer to instances */ +static PARSER_PARSE parse_instance_reference; +static PARSER_FREE free_instance_reference; +static PARSER_DUMP dump_instance_reference; + /* self documentating support */ typedef struct _docoptionNode docoptionNode; typedef struct _docoptions docoptions; @@ -112,7 +123,7 @@ 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 *, PARSER_POST_PARSE *); +void parserRegisterName(parserNameNode *, 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); @@ -588,6 +599,7 @@ return a == NULL; } +#if NEVER static void parse_acl(parserNameNode *parserName, void * data) { @@ -596,6 +608,7 @@ cbdataLock(parserName); aclParseAclLine(ae); } +#endif static void free_acl(parserNameNode *parserName, void *data) @@ -604,8 +617,8 @@ acl ** ae=(acl **)data; used=!check_null_acl(*ae); aclDestroyAcls(ae); - if (used) - cbdataUnlock(parserName); +// if (used) +// cbdataUnlock(parserName); } static int @@ -2365,6 +2378,70 @@ } } +/* Insert any new 'core' types here for registration */ +static void +parserRegisterAllTypes(void) +{ + parserRegisterCFTypes(); + parserRegisterType("instance_node", parse_instance_node, free_instance_node, dump_instance_node); + + parserRegisterType("acl",aclParseAclLine,free_acl,dump_acl); +} + + +//parserRegisterType("acl",parse_acl,free_acl,dump_acl); + + +void *parserRegisterInstanceName(const char *, parserTypeNode *, PARSER_DEFAULT_NONE *, PARSER_POST_PARSE *); + +static void * aclinstances = NULL; + +#define default_if_none_acl NULL +#define name_document_acl NULL + +PARSER_DEFAULT_NONE default_if_no_instances; + +/* Insert any new 'core' names here for registration */ +static void +parserRegisterAllNames(void) +{ + + parserRegisterCFNames(); + + /* ACL.C routines: should be in acl.c */ + +// parserRegisterName("acl",parserTypeByName("instance_node"),&Config.aclList2,default_if_none_acl,name_document_acl, NULL); + + if (aclinstances) + debug(3,0)("bwahhahhahaha\n\n"); + aclinstances = parserRegisterInstanceName("acl", parserTypeByName("acl"), name_document_acl, NULL); + + parserRegisterName(NULL, "acl", parserTypeByName("instance_node"), aclinstances, default_if_none_acl, name_document_acl, NULL); + +/* instance called acl + to parse use type foo */ + + + +/* +instance type called acl. + +registerinstancetype acl + +list referred to as acl +acl has location foo. + + +list has a new entry of type instance at location instance-location. +in foo, add to the type list, +instance, location. + +list has a new entry of type acl at location acl-location +in foo add to the type list +acl, location +*/ +} + #include "cf_parser.c" peer_t @@ -2455,6 +2532,163 @@ return NULL == s; } + +parserNameNode *parserNameByNodeName(dlink_list *, const char *); + + +typedef struct _instance_name instance_name; +typedef struct _instance_node instance_node; + +CBDATA_TYPE(instance_name); +CBDATA_TYPE(instance_node); + +struct _instance_name { + dlink_node node; + dlink_list instances; + char *namestr; + parserTypeNode *type; + PARSER_DEFAULT_NONE *default_none; + PARSER_NAME_DOCUMENT *documentfunc; + PARSER_POST_PARSE *post_parse_func; +}; + +struct _instance_node { + dlink_node node; + dlink_list *head; + char *namestr; + void *data; + parserNameNode *parserName; + instance_name *name; +}; + +static dlink_list instance_names = {NULL,NULL}; + +void +default_if_no_instances(void *data) +{ + instance_name *Name=data; + if (Name->instances.head==NULL) + if (Name->default_none) + Name->default_none(NULL); +} + +/* the free function only occurs when the mempoolfree is about to occur. + * for persistent types, the config function locks the Name node + */ +static void +parserInstanceNameFree(void *data) +{ + instance_name *Name=data; + dlinkDelete(&Name->node,&instance_names); + debug(3,0)("parserNameFree freed name %s\n",Name->namestr); + safe_free(Name->namestr); + cbdataUnlock(Name->type); +} + +instance_name * +parserInstanceNameByName(const char *name) +{ + dlink_node *node; + node=instance_names.head; + while (node && strcmp(((instance_name *)node->data)->namestr,name)) { + node=node->next; + + } + if (node) + return (instance_name *)node->data; + else + return NULL; +} + +void * parserRegisterInstanceName(const char *namestr, parserTypeNode *parserType, PARSER_DEFAULT_NONE *default_none, PARSER_POST_PARSE *post_parse_func) +{ + instance_name *Name; + if ((Name=parserInstanceNameByName(namestr))==NULL) { + /* register the type */ + debug(3,3)("parserRegisterInstanceName new name '%s'\n",Name); + if (instance_names.head==NULL) + CBDATA_INIT_TYPE(instance_name); + Name=CBDATA_ALLOC(instance_name,parserInstanceNameFree); + Name->namestr=xstrdup(namestr); + Name->type=parserType; + cbdataLock(parserType); + Name->default_none=default_none; + Name->post_parse_func=post_parse_func; + dlinkAddTail(Name,&Name->node,&instance_names); + return Name; +} else { + debug(3,0)("parserRegisterName already registered name '%s'\n",Name); + return NULL; + /* TODO: fatal this */ + } +} + +static void +InstanceNodeFree(void *data) +{ + instance_node *instance=data; + dlinkDelete(&instance->node, (instance->head)); + debug(3,0)("parserNameFree freed name %s\n",instance->parserName->namestr); + cbdataUnlock(instance->name); +} + +instance_node * +InstanceByNameStr(instance_name *Name, const char *namestr) +{ + dlink_node *node; + node=Name->instances.head; + while (node && strcmp(((instance_node *)node->data)->namestr,namestr)) { + node=node->next; + } + if (node) + return (instance_node *)node->data; + else + return NULL; +} + +static void +parse_instance_node(parserNameNode *parserName, void * data) +{ + char *token = NULL; + instance_name *Name=data; + instance_node *instance=NULL; + if ((token = strtok(NULL, w_space)) == NULL) { + debug(3, 0) (" %s line %d: %s\n", + cfg_filename, config_lineno, config_input_line); + debug(3, 0) ("parse_instance_node: missing instance name.\n"); + return; + } + + if ((instance=InstanceByNameStr(Name,token))==NULL) { + /* register me */ + if (Name->instances.head==NULL) + CBDATA_INIT_TYPE(instance_node); + instance=CBDATA_ALLOC(instance_node,InstanceNodeFree); + + debug(3,0)("parsing got token %s\n",token); + + instance->namestr=xstrdup(token); + instance->head=&Name->instances; + instance->data=NULL; + parserRegisterName(parserName, instance->namestr, Name->type, &instance->data, NULL, NULL, NULL); + instance->parserName=parserNameByNodeName(&parserName->children, instance->namestr); + assert(instance->parserName); + dlinkAddTail(instance,&instance->node, instance->head); + } + /* parse that instance */ + instance->parserName->type->parsefunc(instance->parserName, instance->parserName->location); +} + +static void +free_instance_node(parserNameNode *parserName, void * data) +{ +} + +static void +dump_instance_node(StoreEntry * e, const char *n, void const * const data) +{ +} + void configFreeMemory(void) { @@ -2558,16 +2792,24 @@ parserNameFree(void *data) { parserNameNode *parserName=data; - dlinkDelete(&parserName->node,&parserNames); + dlink_node *node; + dlinkDelete(&parserName->node,parserName->head); debug(3,0)("parserNameFree freed name %s\n",parserName->namestr); + + node=parserName->children.head; + while (node) { + parserDeregisterName(node->data); + node=node->next; + } + cbdataUnlock(parserName->type); } parserNameNode * -parserNameByName(const char *name) +parserNameByNodeName(dlink_list *parent, const char *name) { dlink_node *node; - node=parserNames.head; + node=parent->head; while (node && strcmp(((parserNameNode *)node->data)->namestr,name)) { node=node->next; } @@ -2577,6 +2819,12 @@ return NULL; } +parserNameNode * +parserNameByName(const char *name) +{ + return parserNameByNodeName(&parserNames,name); +} + /* register a new name for the config file * a name is the first symbol on a line in the config file. * TODO: check for conflicts with cf.data.pre declared names @@ -2585,11 +2833,13 @@ * ignoring errors (because they have been migrated to auto register ). */ void -parserRegisterName(const char *name, parserTypeNode *parserType, void *location, +parserRegisterName(parserNameNode *parent, const char *name, parserTypeNode *parserType, void *location, PARSER_DEFAULT_NONE *default_none, PARSER_NAME_DOCUMENT *documentfunc, PARSER_POST_PARSE *post_parse_func) { parserNameNode *parserName; - if ((parserName=parserNameByName(name))==NULL) { + + + if ((parserName=parserNameByNodeName(parent ? &parent->children : &parserNames, name))==NULL) { /* register the type */ debug(3,3)("parserRegisterName new name '%s'\n",name); if (parserNames.head==NULL) @@ -2602,7 +2852,10 @@ parserName->default_none=default_none; parserName->documentfunc=documentfunc; parserName->post_parse_func=post_parse_func; - dlinkAddTail(parserName,&parserName->node,&parserNames); + parserName->head = parent ? &parent->children : &parserNames; + parserName->children.head=NULL; + parserName->children.tail=NULL; + dlinkAddTail(parserName,&parserName->node,parserName->head); } else { /* confirm the pointers are the same */ debug(3,3)("parserRegisterName already registered name '%s'\n",name); @@ -2670,6 +2923,30 @@ } static int +parse_directive(parserNameNode *parent) +{ + char *token; + parserNameNode *parserName; + if ((token = strtok(NULL, w_space)) == NULL) + return 0; /* fail on directives with no data */ + debug(0,0)("parse_directive: %s\n", token); + if ((parserName=parserNameByNodeName(parent ? &parent->children : &parserNames, token))==NULL) { + /* unregistered child, parse as normal. */ + /* back up strtok a step. Yummy */ + *(token + strlen(token))=' '; + *(token-2) = 'A'; + *(token-1) = ' '; + strtok(token-2,w_space); + parent->type->parsefunc(parent, parent->location); + return 1; + } else { + /* registered child node */ + parserName->type->parsefunc(parserName, parserName->location); + return 1; + } +} + +static int parse_line(char *buff) { char *token; @@ -2682,7 +2959,10 @@ return 0; } else { /* registered name */ - parserName->type->parsefunc(parserName, parserName->location); + if (parserName->children.head) + return parse_directive(parserName); + else + parserName->type->parsefunc(parserName, parserName->location); return 1; } } Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.21.4.11 retrieving revision 1.21.4.12 diff -u -r1.21.4.11 -r1.21.4.12 --- squid/src/cf.data.pre 26 Feb 2001 12:26:28 -0000 1.21.4.11 +++ squid/src/cf.data.pre 11 Mar 2001 21:43:09 -0000 1.21.4.12 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.21.4.11 2001/02/26 12:26:28 rbcollins Exp $ +# $Id: cf.data.pre,v 1.21.4.12 2001/03/11 21:43:09 rbcollins Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1698,6 +1698,7 @@ NAME: acl TYPE: acl +IFDEF: NEVER LOC: Config.aclList DEFAULT: none DEFAULT_IF_NONE: all src 0.0.0.0/0.0.0.0 Index: squid/src/cf_gen.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf_gen.c,v retrieving revision 1.7.8.11 retrieving revision 1.7.8.12 diff -u -r1.7.8.11 -r1.7.8.12 --- squid/src/cf_gen.c 1 Mar 2001 00:31:44 -0000 1.7.8.11 +++ squid/src/cf_gen.c 11 Mar 2001 21:43:09 -0000 1.7.8.12 @@ -1,6 +1,6 @@ /* - * $Id: cf_gen.c,v 1.7.8.11 2001/03/01 00:31:44 rbcollins Exp $ + * $Id: cf_gen.c,v 1.7.8.12 2001/03/11 21:43:09 rbcollins Exp $ * * DEBUG: none Generate squid.conf and cf_parser.c * AUTHOR: Max Okumoto @@ -41,8 +41,8 @@ * The output files are as follows: * cf_parser.c - this file contains, default_all() which * initializes variables with the default - * values, parserRegisterAllTypes() which registers - * all the cf.data.pre types, parserRegisterAllNames() + * values, parserRegisterCFTypes() which registers + * all the cf.data.pre types, parserRegisterCFNames() * which registers all the cf.data.pre Names. * squid.conf.old - legacy version of th default configuration * file given to the server administrator. @@ -405,8 +405,8 @@ fclose(fp); /*-------------------------------------------------------------------* - * Generate parserRegisterAllTypes() - * Generate parserRegisterAllNames() + * Generate parserRegisterCFTypes() + * Generate parserRegisterCFNames() * Generate example squid.conf file *-------------------------------------------------------------------*/ @@ -485,7 +485,7 @@ Entry *entry; fprintf(fp, "static void\n" - "parserRegisterAllTypes(void)\n" + "parserRegisterCFTypes(void)\n" "{\n" ); for (entry = head; entry != NULL; entry = entry->next) { @@ -512,7 +512,7 @@ int rc=0; fprintf(fp, "#define default_if_none_NULL NULL\nstatic void\n" - "parserRegisterAllNames(void)\n" + "parserRegisterCFNames(void)\n" "{\n" "\tcfg_filename=\"Default Configuration\";" "\tconfig_lineno = 0;" @@ -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, NULL);\n", + fprintf(fp, "\tparserRegisterName(NULL, \"%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.15 retrieving revision 1.18.4.16 diff -u -r1.18.4.15 -r1.18.4.16 --- squid/src/protos.h 1 Mar 2001 00:31:44 -0000 1.18.4.15 +++ squid/src/protos.h 11 Mar 2001 21:43:09 -0000 1.18.4.16 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.18.4.15 2001/03/01 00:31:44 rbcollins Exp $ + * $Id: protos.h,v 1.18.4.16 2001/03/11 21:43:09 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -57,7 +57,7 @@ extern void aclDestroyAccessList(struct _acl_access **list); extern void aclDestroyAcls(acl **); extern void aclParseAccessLine(struct _acl_access **); -extern void aclParseAclLine(acl **); +extern PARSER_PARSE aclParseAclLine; extern int aclIsProxyAuth(const char *name); extern int aclGetDenyInfoPage(acl_deny_info_list ** head, const char *name); extern void aclParseDenyInfoLine(struct _acl_deny_info_list **); @@ -69,6 +69,7 @@ extern wordlist *aclDumpGeneric(const acl *); extern int aclPurgeMethodInUse(acl_access *); extern void aclCacheMatchFlush(dlink_list * cache); +extern void aclRegisterAclDirective(void); /* * cache_cf.c @@ -104,10 +105,15 @@ extern void parserDeregisterType(parserTypeNode *); extern parserTypeNode *parserTypeByName(const char *); /* name, type */ -extern void parserRegisterName(const char *, parserTypeNode *, void *, PARSER_DEFAULT_NONE *, PARSER_NAME_DOCUMENT *, PARSER_POST_PARSE *); +extern void parserRegisterName(parserNameNode *, const char *, parserTypeNode *, void *, PARSER_DEFAULT_NONE *, PARSER_NAME_DOCUMENT *, PARSER_POST_PARSE *); extern void parserDeregisterName(parserNameNode *); extern parserNameNode *parserNameByName(const char *); +/* heirarchical parsing */ +//extern void parserRegisterInstanceType(parserNameNode *, const char *, PARSER_PARSE *, PARSER_FREE *, PARSER_DUMP *); + + +void * parserRegisterInstanceName(const char *, parserTypeNode *, PARSER_DEFAULT_NONE *, PARSER_POST_PARSE *); /* * cbdata.c Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.24.4.14 retrieving revision 1.24.4.15 diff -u -r1.24.4.14 -r1.24.4.15 --- squid/src/structs.h 1 Mar 2001 00:31:44 -0000 1.24.4.14 +++ squid/src/structs.h 11 Mar 2001 21:43:09 -0000 1.24.4.15 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.24.4.14 2001/03/01 00:31:44 rbcollins Exp $ + * $Id: structs.h,v 1.24.4.15 2001/03/11 21:43:09 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -312,6 +312,8 @@ struct _parserNameNode { dlink_node node; + dlink_list children; + dlink_list *head; const char *namestr; parserTypeNode *type; PARSER_DEFAULT_NONE *default_none; @@ -576,6 +578,7 @@ int pipeline_prefetch; } onoff; acl *aclList; + dlink_list aclList2; struct { acl_access *http; acl_access *icp; 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.6 retrieving revision 1.9.4.7 diff -u -r1.9.4.6 -r1.9.4.7 --- squid/src/auth/basic/auth_basic.c 1 Mar 2001 00:31:45 -0000 1.9.4.6 +++ squid/src/auth/basic/auth_basic.c 11 Mar 2001 21:43:10 -0000 1.9.4.7 @@ -146,12 +146,12 @@ mod_install_basic (const char *namestr) { authSchemeAdd(namestr, authSchemeSetup_basic); - parserRegisterName("authenticate_basic_program", parserTypeByName("wordlist"), &basicConfig.authenticate, NULL, authBasicDocumentProgram, NULL); - parserRegisterName("authenticate_basic_children", parserTypeByName("int"), &basicConfig.authenticateChildren, NULL, authBasicDocumentChildren, NULL); + parserRegisterName(NULL, "authenticate_basic_program", parserTypeByName("wordlist"), &basicConfig.authenticate, NULL, authBasicDocumentProgram, NULL); + parserRegisterName(NULL, "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, NULL); + parserRegisterName(NULL, "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, NULL); + parserRegisterName(NULL, "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.4 retrieving revision 1.4.4.5 diff -u -r1.4.4.4 -r1.4.4.5 --- squid/src/auth/digest/auth_digest.c 1 Mar 2001 00:31:45 -0000 1.4.4.4 +++ squid/src/auth/digest/auth_digest.c 11 Mar 2001 21:43:10 -0000 1.4.4.5 @@ -633,12 +633,12 @@ mod_install_digest (const char *namestr) { authSchemeAdd(namestr, authSchemeSetup_digest); - 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); + parserRegisterName(NULL, "authenticate_digest_program", parserTypeByName("wordlist"), &digestConfig.authenticate, NULL, authDigestDocumentProgram, NULL); + parserRegisterName(NULL, "authenticate_digest_children", parserTypeByName("int"), &digestConfig.authenticateChildren, NULL, authBasicDocumentChildren, NULL); + parserRegisterName(NULL, "authenticate_digest_realm", parserTypeByName("eol"), &digestConfig.digestAuthRealm, NULL, authBasicDocumentRealm, NULL); + parserRegisterName(NULL, "authenticate_digest_nonce_garbage_interval", parserTypeByName("time_t"), &digestConfig.nonceGCInterval, NULL, authBasicDocumentGCInterval, NULL); + parserRegisterName(NULL, "authenticate_digest_nonce_max_duration", parserTypeByName("time_t"), &digestConfig.noncemaxduration, NULL, authBasicDocumentNonceDuration, NULL); + parserRegisterName(NULL, "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.4 retrieving revision 1.7.6.5 diff -u -r1.7.6.4 -r1.7.6.5 --- squid/src/auth/ntlm/auth_ntlm.c 1 Mar 2001 00:31:45 -0000 1.7.6.4 +++ squid/src/auth/ntlm/auth_ntlm.c 11 Mar 2001 21:43:10 -0000 1.7.6.5 @@ -148,12 +148,12 @@ mod_install_ntlm (const char *namestr) { authSchemeAdd(namestr, authSchemeSetup_ntlm); - parserRegisterName("authenticate_ntlm_program", parserTypeByName("wordlist"), &ntlmConfig.authenticate, NULL, authNTLMDocumentProgram, NULL); - parserRegisterName("authenticate_ntlm_children", parserTypeByName("int"), &ntlmConfig.authenticateChildren, NULL, authNTLMDocumentChildren, NULL); + parserRegisterName(NULL, "authenticate_ntlm_program", parserTypeByName("wordlist"), &ntlmConfig.authenticate, NULL, authNTLMDocumentProgram, NULL); + parserRegisterName(NULL, "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, NULL); + parserRegisterName(NULL, "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, NULL); + parserRegisterName(NULL, "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 */