]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Replaced 'cache_host_acl' with 'cache_host_access' so its just like the
authorwessels <>
Thu, 4 Jun 1998 02:34:41 +0000 (02:34 +0000)
committerwessels <>
Thu, 4 Jun 1998 02:34:41 +0000 (02:34 +0000)
other ACL access lists.

src/cache_cf.cc
src/cf.data.pre
src/neighbors.cc
src/structs.h

index 56dd6dd5ff77c323f002b6ca9f414e8fc95c117c..d38ad449ad8dc65a3c4f5dd48d9561a1f78f9afa 100644 (file)
@@ -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
index e4ab01cf425b0b538bcf0eb821a7d80db3906705..b6033a3a89a23f568e6e53a90e99ff729b772afa 100644 (file)
@@ -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
index 047e041fa1ad85670d140a5af4029b89a1f39a88..f81862eb28bb6929557b5ed926f0139b8ff32488 100644 (file)
@@ -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.   */
index b7fa4e714c7beb47f1697cd326fa6204e2f474b1..d421fe808d161820f12e43b0baa2e2a877ff1b3a 100644 (file)
@@ -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 {