]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Prevent NULL pointer access in aclMatchAcl(). Some ACL types require
authorwessels <>
Tue, 2 Jan 2001 05:03:55 +0000 (05:03 +0000)
committerwessels <>
Tue, 2 Jan 2001 05:03:55 +0000 (05:03 +0000)
checklist->request_t, but it won't be available in some cases (like
snmp_access).  Warn the admin that the ACL can't be checked and that
we're denying it.

src/acl.cc

index 648e13774b374a72b30049546313410edfde3543..f16e9cb38f3dfc8b95b93f76e2540b38dcfea8a0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.cc,v 1.226 2000/12/08 23:58:08 wessels Exp $
+ * $Id: acl.cc,v 1.227 2001/01/01 22:03:55 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -1319,6 +1319,25 @@ aclMatchAcl(acl * ae, aclCheck_t * checklist)
     int k;
     if (!ae)
        return 0;
+    switch (ae->type) {
+    case ACL_DST_IP:
+    case ACL_DST_DOMAIN:
+    case ACL_DST_DOM_REGEX:
+    case ACL_URLPATH_REGEX:
+    case ACL_URL_PORT:
+    case ACL_PROTO:
+    case ACL_METHOD:
+    case ACL_DST_ASN:
+       /* These ACL types require checklist->request */
+       if (NULL == r) {
+           debug(28, 1) ("WARNING: '%s' ACL is used but there is no"
+               " HTTP request -- access denied.\n", ae->name);
+           return 0;
+       }
+       break;
+    default:
+       break;
+    }
     debug(28, 3) ("aclMatchAcl: checking '%s'\n", ae->cfgline);
     switch (ae->type) {
     case ACL_SRC_IP: