--------------------- PatchSet 2103 Date: 2001/04/26 23:54:41 Author: rbcollins Branch: generic_modules Tag: (none) Log: removed more ACL enums Members: src/acl.c:1.21.4.13->1.21.4.14 src/acl.h:1.1.2.3->1.1.2.4 src/enums.h:1.14.4.7->1.14.4.8 src/mem.c:1.8.8.2->1.8.8.3 src/protos.h:1.18.4.21->1.18.4.22 src/structs.h:1.24.4.19->1.24.4.20 Index: squid/src/acl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/acl.c,v retrieving revision 1.21.4.13 retrieving revision 1.21.4.14 diff -u -r1.21.4.13 -r1.21.4.14 --- squid/src/acl.c 26 Apr 2001 00:09:08 -0000 1.21.4.13 +++ squid/src/acl.c 26 Apr 2001 23:54:41 -0000 1.21.4.14 @@ -1,6 +1,6 @@ /* - * $Id: acl.c,v 1.21.4.13 2001/04/26 00:09:08 rbcollins Exp $ + * $Id: acl.c,v 1.21.4.14 2001/04/26 23:54:41 rbcollins Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -54,6 +54,12 @@ static int aclFromFile = 0; static FILE *aclFile; MemPool * acl_pool = NULL; +MemPool * acl_deny_info_list_pool = NULL; +MemPool * acl_ip_data_pool = NULL; +MemPool * acl_name_list_pool = NULL; +MemPool * acl_time_data_pool = NULL; +MemPool * acl_proxy_auth_match_pool = NULL; +MemPool * acl_user_data_pool = NULL; static PARSER_PARSE aclParseDomainList; static PARSER_PARSE aclParseUserList; @@ -213,61 +219,6 @@ return t; } } -#if 0 -const char * -aclTypeToStr(squid_acl type) -{ - if (type == ACL_DYNAMIC) - fatal("dynamic acl encountered\n"); -#if 0 - if (type == ACL_DST_IP) - return "dst???"; - if (type == ACL_DST_DOMAIN) - return "dstdomain???"; - if (type == ACL_SRC_DOMAIN) - return "srcdomain???"; - if (type == ACL_DST_DOM_REGEX) - return "dstdom_regex???"; - if (type == ACL_SRC_DOM_REGEX) - return "srcdom_regex???"; - if (type == ACL_URLPATH_REGEX) - return "urlpath_regex??"; - if (type == ACL_URL_REGEX) - return "url_regex??"; - if (type == ACL_URL_PORT) - return "port??"; - if (type == ACL_MY_PORT) - return "myport??"; - if (type == ACL_MAXCONN) - return "maxconn???"; -#if USE_IDENT - if (type == ACL_IDENT) - return "ident???"; - if (type == ACL_IDENT_REGEX) - return "ident_regex???"; -#endif - if (type == ACL_BROWSER) - return "browser??"; - if (type == ACL_PROXY_AUTH) - return "proxy_auth"; - if (type == ACL_PROXY_AUTH_REGEX) - return "proxy_auth_regex????"; - if (type == ACL_SRC_ASN) - return "src_as"; - if (type == ACL_DST_ASN) - return "dst_as"; -#if SQUID_SNMP - if (type == ACL_SNMP_COMMUNITY) - return "snmp_community"; -#endif -#if SRC_RTT_NOT_YET_FINISHED - if (type == ACL_NETDB_SRC_RTT) - return "src_rtt"; -#endif -#endif - return "ERROR"; -} -#endif static acl * aclFindByName(const char *name) @@ -411,7 +362,7 @@ LOCAL_ARRAY(char, addr1, 256); LOCAL_ARRAY(char, addr2, 256); LOCAL_ARRAY(char, mask, 256); - acl_ip_data *q = memAllocate(MEM_ACL_IP_DATA); + acl_ip_data *q = memPoolAlloc(acl_ip_data_pool); acl_ip_data *r; acl_ip_data **Q; struct hostent *hp; @@ -448,7 +399,7 @@ Q = &q; for (x = hp->h_addr_list; x != NULL && *x != NULL; x++) { if ((r = *Q) == NULL) - r = *Q = memAllocate(MEM_ACL_IP_DATA); + r = *Q = memPoolAlloc(acl_ip_data_pool); xmemcpy(&r->addr1.s_addr, *x, sizeof(r->addr1.s_addr)); r->addr2.s_addr = 0; r->mask.s_addr = no_addr.s_addr; /* 255.255.255.255 */ @@ -521,7 +472,7 @@ int h1, m1, h2, m2; char *t = NULL; for (Tail = curlist; *Tail; Tail = &((*Tail)->next)); - q = memAllocate(MEM_ACL_TIME_DATA); + q = memPoolAlloc(acl_time_data_pool); while ((t = strtokFile())) { if (*t < '0' || *t > '9') { /* assume its day-of-week spec */ @@ -567,7 +518,7 @@ debug(28, 0) ("%s line %d: %s\n", cfg_filename, config_lineno, config_input_line); debug(28, 0) ("aclParseTimeSpec: IGNORING Bad time range\n"); - memFree(q, MEM_ACL_TIME_DATA); + memPoolFree(acl_time_data_pool, q); return; } q->start = h1 * 60 + m1; @@ -576,7 +527,7 @@ debug(28, 0) ("%s line %d: %s\n", cfg_filename, config_lineno, config_input_line); debug(28, 0) ("aclParseTimeSpec: IGNORING Reversed time range\n"); - memFree(q, MEM_ACL_TIME_DATA); + memPoolFree(acl_time_data_pool, q); return; } } @@ -647,7 +598,7 @@ debug(28, 2) ("aclParseUserList: parsing user list\n"); if (*current == NULL) { debug(28, 3) ("aclParseUserList: current is null. Creating\n"); - *current = memAllocate(MEM_ACL_USER_DATA); + *current = memPoolAlloc(acl_user_data_pool); } data = *current; Top = data->names; @@ -870,14 +821,14 @@ debug(28, 0) ("aclParseDenyInfoLine: missing 'error page' parameter.\n"); return; } - A = memAllocate(MEM_ACL_DENY_INFO_LIST); + A = memPoolAlloc(acl_deny_info_list_pool); A->err_page_id = errorReservePageId(t); A->err_page_name = xstrdup(t); A->next = (acl_deny_info_list *) NULL; /* next expect a list of ACL names */ Tail = &A->acl_list; while ((t = strtok(NULL, w_space))) { - L = memAllocate(MEM_ACL_NAME_LIST); + L = memPoolAlloc(acl_name_list_pool); xstrncpy(L->name, t, ACL_NAME_SZ); *Tail = L; Tail = &L->next; @@ -886,7 +837,7 @@ debug(28, 0) ("%s line %d: %s\n", cfg_filename, config_lineno, config_input_line); debug(28, 0) ("aclParseDenyInfoLine: deny_info line contains no ACL's, skipping\n"); - memFree(A, MEM_ACL_DENY_INFO_LIST); + memPoolFree(acl_deny_info_list_pool, A); return; } for (B = *head, T = head; B; T = &B->next, B = B->next); /* find the tail */ @@ -1421,7 +1372,7 @@ fatal("aclCacheMatchAcl: unknown or unexpected ACL type"); return 0; /* NOTREACHED */ } - auth_match = memAllocate(MEM_ACL_PROXY_AUTH_MATCH); + auth_match = memPoolAlloc(acl_proxy_auth_match_pool); auth_match->matchrv = matchrv; auth_match->acl_data = data; dlinkAddTail(auth_match, &auth_match->link, cache); @@ -1439,7 +1390,7 @@ tmplink = link; link = link->next; dlinkDelete(tmplink, cache); - memFree(auth_match, MEM_ACL_PROXY_AUTH_MATCH); + memPoolFree(acl_proxy_auth_match_pool, auth_match); } } @@ -2155,7 +2106,7 @@ acl_time_data *next = NULL; for (; data; data = next) { next = data->next; - memFree(data, MEM_ACL_TIME_DATA); + memPoolFree(acl_time_data_pool, data); } } @@ -2175,7 +2126,7 @@ static void aclFreeIpData(void *p) { - memFree(p, MEM_ACL_IP_DATA); + memPoolFree(acl_ip_data_pool, p); } static void @@ -2202,7 +2153,7 @@ acl_user_data *d = data; if (d->names) splay_destroy(d->names, xfree); - memFree(d, MEM_ACL_USER_DATA); + memPoolFree(acl_user_data_pool, d); } void @@ -2321,7 +2272,7 @@ } a_next = a->next; xfree(a->err_page_name); - memFree(a, MEM_ACL_DENY_INFO_LIST); + memPoolFree(acl_deny_info_list_pool, a); } *list = NULL; } @@ -3040,6 +2991,20 @@ // This should be in the acl module init code. if (!acl_pool) acl_pool = memPoolCreate("acl", sizeof(acl)); + if (!acl_deny_info_list_pool) + acl_deny_info_list_pool = memPoolCreate("acl_deny_info_list", + sizeof(acl_deny_info_list)); + if (!acl_ip_data_pool) + acl_ip_data_pool = memPoolCreate("acl_ip_data", sizeof(acl_ip_data)); + if (!acl_name_list_pool) + acl_name_list_pool = memPoolCreate("acl_name_list", sizeof(acl_name_list)); + if (!acl_time_data_pool) + acl_time_data_pool = memPoolCreate("acl_time_data", sizeof(acl_time_data)); + if (!acl_proxy_auth_match_pool) + acl_proxy_auth_match_pool = memPoolCreate("acl_proxy_auth_match_cache", + sizeof(acl_proxy_auth_match_cache)); + if (!acl_user_data_pool) + acl_user_data_pool = memPoolCreate("acl_user_data", sizeof(acl_user_data)); /* register the ACL types */ parserRegisterType("acl",aclParseAclLine,free_acl,dump_acl); Index: squid/src/acl.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/acl.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid/src/acl.h 26 Apr 2001 00:09:08 -0000 1.1.2.3 +++ squid/src/acl.h 26 Apr 2001 23:54:41 -0000 1.1.2.4 @@ -46,6 +46,40 @@ acl *next; }; +struct _acl_user_data { + splayNode *names; + struct { + unsigned int case_insensitive:1; + unsigned int required:1; + } flags; +}; + + +struct _acl_ip_data { + struct in_addr addr1; /* if addr2 non-zero then its a range */ + struct in_addr addr2; + struct in_addr mask; + acl_ip_data *next; /* used for parsing, not for storing */ +}; + +struct _acl_time_data { + int weekbits; + int start; + int stop; + acl_time_data *next; +}; + +struct _acl_name_list { + char name[ACL_NAME_SZ]; + acl_name_list *next; +}; + +struct _acl_proxy_auth_match_cache { + dlink_node link; + int matchrv; + void *acl_data; +}; + extern aclName *aclRegisterAclName(const char *, parserTypeNode *, ACLMATCH *); extern aclName *aclNameByName(const char *); Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/enums.h,v retrieving revision 1.14.4.7 retrieving revision 1.14.4.8 diff -u -r1.14.4.7 -r1.14.4.8 --- squid/src/enums.h 26 Apr 2001 00:09:09 -0000 1.14.4.7 +++ squid/src/enums.h 26 Apr 2001 23:54:41 -0000 1.14.4.8 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.14.4.7 2001/04/26 00:09:09 rbcollins Exp $ + * $Id: enums.h,v 1.14.4.8 2001/04/26 23:54:41 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -544,15 +544,15 @@ // MEM_ACL, MEM_ACLCHECK_T, MEM_ACL_ACCESS, - MEM_ACL_DENY_INFO_LIST, - MEM_ACL_IP_DATA, +// MEM_ACL_DENY_INFO_LIST, +// MEM_ACL_IP_DATA, MEM_ACL_LIST, - MEM_ACL_NAME_LIST, +// MEM_ACL_NAME_LIST, MEM_AUTH_USER_T, MEM_AUTH_USER_HASH, - MEM_ACL_PROXY_AUTH_MATCH, - MEM_ACL_USER_DATA, - MEM_ACL_TIME_DATA, +// MEM_ACL_PROXY_AUTH_MATCH, +// MEM_ACL_USER_DATA, +// MEM_ACL_TIME_DATA, MEM_CACHEMGR_PASSWD, #if USE_CACHE_DIGESTS MEM_CACHE_DIGEST, Index: squid/src/mem.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mem.c,v retrieving revision 1.8.8.2 retrieving revision 1.8.8.3 diff -u -r1.8.8.2 -r1.8.8.3 --- squid/src/mem.c 24 Apr 2001 13:34:16 -0000 1.8.8.2 +++ squid/src/mem.c 26 Apr 2001 23:54:41 -0000 1.8.8.3 @@ -1,6 +1,6 @@ /* - * $Id: mem.c,v 1.8.8.2 2001/04/24 13:34:16 rbcollins Exp $ + * $Id: mem.c,v 1.8.8.3 2001/04/26 23:54:41 rbcollins Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -198,20 +198,20 @@ // memDataInit(MEM_ACL, "acl", sizeof(acl), 0); memDataInit(MEM_ACLCHECK_T, "aclCheck_t", sizeof(aclCheck_t), 0); memDataInit(MEM_ACL_ACCESS, "acl_access", sizeof(acl_access), 0); - memDataInit(MEM_ACL_DENY_INFO_LIST, "acl_deny_info_list", - sizeof(acl_deny_info_list), 0); - memDataInit(MEM_ACL_IP_DATA, "acl_ip_data", sizeof(acl_ip_data), 0); +// memDataInit(MEM_ACL_DENY_INFO_LIST, "acl_deny_info_list", +// sizeof(acl_deny_info_list), 0); +// memDataInit(MEM_ACL_IP_DATA, "acl_ip_data", sizeof(acl_ip_data), 0); memDataInit(MEM_ACL_LIST, "acl_list", sizeof(acl_list), 0); - memDataInit(MEM_ACL_NAME_LIST, "acl_name_list", sizeof(acl_name_list), 0); - memDataInit(MEM_ACL_TIME_DATA, "acl_time_data", sizeof(acl_time_data), 0); +// memDataInit(MEM_ACL_NAME_LIST, "acl_name_list", sizeof(acl_name_list), 0); +// memDataInit(MEM_ACL_TIME_DATA, "acl_time_data", sizeof(acl_time_data), 0); memDataInit(MEM_AUTH_USER_T, "auth_user_t", sizeof(auth_user_t), 0); memDataInit(MEM_AUTH_USER_HASH, "auth_user_hash_pointer", sizeof(auth_user_hash_pointer), 0); - memDataInit(MEM_ACL_PROXY_AUTH_MATCH, "acl_proxy_auth_match_cache", - sizeof(acl_proxy_auth_match_cache), 0); - memDataInit(MEM_ACL_USER_DATA, "acl_user_data", - sizeof(acl_user_data), 0); +// memDataInit(MEM_ACL_PROXY_AUTH_MATCH, "acl_proxy_auth_match_cache", +// sizeof(acl_proxy_auth_match_cache), 0); +// memDataInit(MEM_ACL_USER_DATA, "acl_user_data", +// sizeof(acl_user_data), 0); memDataInit(MEM_CACHEMGR_PASSWD, "cachemgr_passwd", sizeof(cachemgr_passwd), 0); #if USE_CACHE_DIGESTS Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.18.4.21 retrieving revision 1.18.4.22 diff -u -r1.18.4.21 -r1.18.4.22 --- squid/src/protos.h 26 Apr 2001 00:09:09 -0000 1.18.4.21 +++ squid/src/protos.h 26 Apr 2001 23:54:41 -0000 1.18.4.22 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.18.4.21 2001/04/26 00:09:09 rbcollins Exp $ + * $Id: protos.h,v 1.18.4.22 2001/04/26 23:54:41 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -65,9 +65,11 @@ extern err_type aclGetDenyInfoPage(acl_deny_info_list ** head, const char *name); extern void aclParseDenyInfoLine(struct _acl_deny_info_list **); extern void aclDestroyDenyInfoList(struct _acl_deny_info_list **); +#if 0 extern PARSER_FREE aclDestroyRegexList; extern int aclMatchRegex(relist * data, const char *word); extern PARSER_PARSE aclParseRegexList; +#endif extern const char *aclTypeToStr(squid_acl); extern wordlist *aclDumpGeneric(const acl *); extern int aclPurgeMethodInUse(acl_access *); Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.24.4.19 retrieving revision 1.24.4.20 diff -u -r1.24.4.19 -r1.24.4.20 --- squid/src/structs.h 25 Apr 2001 12:28:59 -0000 1.24.4.19 +++ squid/src/structs.h 26 Apr 2001 23:54:41 -0000 1.24.4.20 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.24.4.19 2001/04/25 12:28:59 rbcollins Exp $ + * $Id: structs.h,v 1.24.4.20 2001/04/26 23:54:41 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -36,40 +36,6 @@ /* FIXME: remove this - no global structures should refer to the parser library */ #include "squid_parser.h" -struct _acl_user_data { - splayNode *names; - struct { - unsigned int case_insensitive:1; - unsigned int required:1; - } flags; -}; - - -struct _acl_ip_data { - struct in_addr addr1; /* if addr2 non-zero then its a range */ - struct in_addr addr2; - struct in_addr mask; - acl_ip_data *next; /* used for parsing, not for storing */ -}; - -struct _acl_time_data { - int weekbits; - int start; - int stop; - acl_time_data *next; -}; - -struct _acl_name_list { - char name[ACL_NAME_SZ]; - acl_name_list *next; -}; - -struct _acl_proxy_auth_match_cache { - dlink_node link; - int matchrv; - void *acl_data; -}; - struct _auth_user_hash_pointer { /* first two items must be same as hash_link */ char *key;