From: wessels <> Date: Thu, 4 Jun 1998 02:34:41 +0000 (+0000) Subject: Replaced 'cache_host_acl' with 'cache_host_access' so its just like the X-Git-Tag: SQUID_3_0_PRE1~3186 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=505e35db6f84bcad19f8d366753a77955dc842d2;p=thirdparty%2Fsquid.git Replaced 'cache_host_acl' with 'cache_host_access' so its just like the other ACL access lists. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 56dd6dd5ff..d38ad449ad 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.284 1998/06/02 04:18:16 wessels Exp $ + * $Id: cache_cf.cc,v 1.285 1998/06/03 20:34:41 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -450,7 +450,7 @@ dump_snmp_access(StoreEntry * entry, const char *name, communityEntry * Head) storeAppendPrintf(entry, "%s %s %s %s%s\n", name, cp->name, head->allow ? "Allow" : "Deny", - l->op ? "" : "!", + l->op ? null_string : "!", l->acl->name); } head = head->next; @@ -464,13 +464,15 @@ dump_acl_access(StoreEntry * entry, const char *name, acl_access * head) { acl_list *l; while (head != NULL) { - for (l = head->acl_list; l != NULL; l = l->next) { - storeAppendPrintf(entry, "%s %s %s%s\n", + storeAppendPrintf(entry, "%s %s", name, - head->allow ? "Allow" : "Deny", - l->op ? "" : "!", + head->allow ? "Allow" : "Deny"); + for (l = head->acl_list; l != NULL; l = l->next) { + storeAppendPrintf(entry, " %s%s", + l->op ? null_string : "!", l->acl->name); } + storeAppendPrintf(entry, "\n"); head = head->next; } } @@ -666,9 +668,32 @@ free_cachedir(cacheSwap * swap) swap->n_configured = 0; } +const char * +peer_type_str(const peer_t type) +{ + switch(type) { + case PEER_PARENT: + return "parent"; + break; + case PEER_SIBLING: + return "sibling"; + break; + case PEER_MULTICAST: + return "multicast"; + break; + default: + return "unknown"; + break; + } +} + static void dump_peer(StoreEntry * entry, const char *name, peer * p) { + domain_ping *d; + acl_access *a; + domain_type *t; + LOCAL_ARRAY(char, xname, 128); while (p != NULL) { storeAppendPrintf(entry, "%s %s %s %d %d", name, @@ -677,6 +702,22 @@ dump_peer(StoreEntry * entry, const char *name, peer * p) p->http_port, p->icp_port); dump_peer_options(entry, p); + for (d = p->pinglist; d; d = d->next) { + storeAppendPrintf(entry, "cache_peer_domain %s %s%s\n", + p->host, + d->do_ping ? null_string : "!", + d->domain); + } + if ((a = p->access)) { + snprintf(xname, 128, "cache_peer_access %s", p->host); + dump_acl_access(entry, xname, p->access); + } + for (t = p->typelist; t; t = t->next) { + storeAppendPrintf(entry, "neighbor_type_domain %s %s %s\n", + p->host, + peer_type_str(t->type), + t->domain); + } p = p->next; } } @@ -847,42 +888,18 @@ free_denyinfo(acl_deny_info_list ** list) } static void -parse_peeracl(void) +parse_peer_access(void) { char *host = NULL; - char *aclname = NULL; - + peer *p; if (!(host = strtok(NULL, w_space))) self_destruct(); - while ((aclname = strtok(NULL, list_sep))) { - peer *p; - acl_list *L = NULL; - acl_list **Tail = NULL; - acl *a = NULL; if ((p = peerFindByName(host)) == NULL) { debug(15, 0) ("%s, line %d: No cache_peer '%s'\n", cfg_filename, config_lineno, host); return; } - L = xcalloc(1, sizeof(acl_list)); - L->op = 1; - if (*aclname == '!') { - L->op = 0; - aclname++; - } - debug(15, 3) ("neighborAddAcl: looking for ACL name '%s'\n", aclname); - a = aclFindByName(aclname); - if (a == NULL) { - debug(15, 0) ("%s line %d: %s\n", - cfg_filename, config_lineno, config_input_line); - debug(15, 0) ("neighborAddAcl: ACL name '%s' not found.\n", aclname); - xfree(L); - return; - } - L->acl = a; - for (Tail = &p->acls; *Tail; Tail = &(*Tail)->next); - *Tail = L; - } + aclParseAccessLine(&p->access); } static void diff --git a/src/cf.data.pre b/src/cf.data.pre index e4ab01cf42..b6033a3a89 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1320,23 +1320,19 @@ miss_access allow all DOC_END -NAME: cache_peer_acl cache_host_acl -TYPE: peeracl +NAME: cache_peer_access +TYPE: peer_access DEFAULT: none LOC: none DOC_START - Just like 'cache_peer_domain' but provides more flexibility by - using ACL's. + Similar to 'cache_peer_domain' but provides more flexibility by + using ACL elements. - cache_peer_acl cache-host [!]aclname ... + cache_peer_access cache-host allow|deny [!]aclname ... - NOTE: * Any number of ACL's may be given for a cache-host, - either on the same or separate lines. - * When multiple ACL's are given for a particular - cache-host, the first matched ACL is applied. - * Cache hosts with no domain or ACL restrictions are - queried for all requests. - * There are no defaults. + The syntax is identical to 'http_access' and the other lists of + ACL elements. See the comments for 'http_access' below, or + the Squid FAQ (http://squid.nlanr.net/Squid/FAQ/FAQ-10.html). DOC_END COMMENT_START diff --git a/src/neighbors.cc b/src/neighbors.cc index 047e041fa1..f81862eb28 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.219 1998/05/28 23:43:45 wessels Exp $ + * $Id: neighbors.cc,v 1.220 1998/06/03 20:34:44 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -197,7 +197,7 @@ peerAllowedToUse(const peer * p, request_t * request) if (EBIT_TEST(request->flags, REQ_REFRESH)) if (neighborType(p, request) == PEER_SIBLING) return 0; - if (p->pinglist == NULL && p->acls == NULL) + if (p->pinglist == NULL && p->access == NULL) return do_ping; do_ping = 0; for (d = p->pinglist; d; d = d->next) { @@ -209,9 +209,11 @@ peerAllowedToUse(const peer * p, request_t * request) } if (p->pinglist && 0 == do_ping) return do_ping; + if (p->access == NULL) + return do_ping; checklist.src_addr = request->client_addr; checklist.request = request; - return aclMatchAclList(p->acls, &checklist); + return aclCheckFast(p->access, &checklist); } /* Return TRUE if it is okay to send an ICP request to this peer. */ diff --git a/src/structs.h b/src/structs.h index b7fa4e714c..d421fe808d 100644 --- a/src/structs.h +++ b/src/structs.h @@ -874,7 +874,7 @@ struct _peer { int icp_version; domain_ping *pinglist; domain_type *typelist; - acl_list *acls; + acl_access *access; int options; int weight; struct {