]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1166: Configuration confusing when empty acls are encountered
authorhno <>
Fri, 6 May 2005 07:57:55 +0000 (07:57 +0000)
committerhno <>
Fri, 6 May 2005 07:57:55 +0000 (07:57 +0000)
Bug #1255: http_access line with unknown acls

This patch makes Squid very strict about access configuration errors.
Previously Squid ignored most errors, now it rejects the configuraiton
with an description of the error seen.

26 files changed:
src/ACL.h
src/ACLARP.cc
src/ACLARP.h
src/ACLDestinationDomain.cc
src/ACLDestinationDomain.h
src/ACLExtUser.cc
src/ACLExtUser.h
src/ACLIP.cc
src/ACLIP.h
src/ACLIdent.cc
src/ACLIdent.h
src/ACLMaxConnection.cc
src/ACLMaxConnection.h
src/ACLMaxUserIP.cc
src/ACLMaxUserIP.h
src/ACLProxyAuth.cc
src/ACLProxyAuth.h
src/ACLStrategised.h
src/ACLTimeData.cc
src/AuthUserRequest.cc
src/AuthUserRequest.h
src/ExternalACL.h
src/acl.cc
src/cache_cf.cc
src/external_acl.cc
src/tools.cc

index b7909cc6893d557be8acf3d1ba3d9756b6a768b6..2136d8b44ad4b62f6073e4c345c8f1d3fe10b494 100644 (file)
--- a/src/ACL.h
+++ b/src/ACL.h
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACL.h,v 1.12 2004/08/30 05:12:30 robertc Exp $
+ * $Id: ACL.h,v 1.13 2005/05/06 01:57:55 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -78,7 +78,8 @@ public:
     virtual int match(ACLChecklist * checklist) = 0;
     virtual wordlist *dumpGeneric() const;
     virtual wordlist *dump() const = 0;
-    virtual bool valid () const =0;
+    virtual bool empty () const = 0;
+    virtual bool valid () const;
     int checklistMatches(ACLChecklist *);
 
     int cacheMatchAcl(dlink_list * cache, ACLChecklist *);
index bee7ef9cf1f83de773468792c312d68a5d175d6c..8d0b96d4671ab1bbfa467edf6cad2371627fec65 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLARP.cc,v 1.12 2005/04/18 21:52:41 hno Exp $
+ * $Id: ACLARP.cc,v 1.13 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -118,7 +118,7 @@ ACLARP::typeString() const
 }
 
 bool
-ACLARP::valid () const
+ACLARP::empty () const
 {
     return data != NULL;
 }
index 050e464380c9c78e10aaf365e8202e7693131bae..daa3e58e34a60d5567a608c05d2ea654566a1bac 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACLARP.h,v 1.3 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLARP.h,v 1.4 2005/05/06 01:57:55 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -60,7 +60,7 @@ public:
     virtual void parse();
     virtual int match(ACLChecklist *checklist);
     virtual wordlist *dump() const;
-    virtual bool valid () const;
+    virtual bool empty () const;
 
 protected:
     static Prototype RegistryProtoype;
index 32b30072e90ccce30e4515c39daa341df4f401e5..5feddcb474d0cf39199b040271dca7af2d4277dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLDestinationDomain.cc,v 1.7 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLDestinationDomain.cc,v 1.8 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -104,7 +104,7 @@ ACLDestinationDomain::dump() const
 }
 
 bool
-ACLDestinationDomain::valid () const
+ACLDestinationDomain::empty () const
 {
     return data != NULL;
 }
index 9cc1c5a6161e99dcf2cc98f1dab8f742de237de0..f35edc38e39ef2e3e867d5678b0b1ba1aded16e3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACLDestinationDomain.h,v 1.6 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLDestinationDomain.h,v 1.7 2005/05/06 01:57:55 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -66,7 +66,7 @@ public:
     virtual void parse();
     virtual int match(ACLChecklist *checklist);
     virtual wordlist *dump() const;
-    virtual bool valid () const;
+    virtual bool empty () const;
     virtual bool requiresRequest() const {return true;}
 
     virtual ACL *clone()const;
index 01adcd77bd8227a81fe40f0477f38090f15746c5..065f0f68aabaea3826fd20eb0db4a9035473560f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLExtUser.cc,v 1.5 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLExtUser.cc,v 1.6 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -92,7 +92,7 @@ ACLExtUser::dump() const
 }
 
 bool
-ACLExtUser::valid () const
+ACLExtUser::empty () const
 {
     return data != NULL;
 }
index 99b9fee5d31b2d8ea66ff7fd883c6479aa6782ee..89e6002fb6d18355187575ef72fbba05931b610a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACLExtUser.h,v 1.4 2005/03/30 23:04:09 hno Exp $
+ * $Id: ACLExtUser.h,v 1.5 2005/05/06 01:57:55 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -55,7 +55,7 @@ public:
 
     virtual int match(ACLChecklist *checklist);
     virtual wordlist *dump() const;
-    virtual bool valid () const;
+    virtual bool empty () const;
     virtual ACL *clone()const;
 
 private:
index a252612bb28d59adeed943ec73908283fd5c96eb..db73250a70e73a50b7310c0cfe2d8ac121584189 100644 (file)
@@ -202,8 +202,6 @@ acl_ip_data::DecodeMask(const char *asc, struct IN_ADDR *mask)
     if (safe_inet_addr(asc, mask))
         return 1;
 
-    debug(28, 0) ("DecodeAddress: Invalid IP address: '%s'\n", asc);
-
     return 0;
 }
 
@@ -255,8 +253,7 @@ acl_ip_data::FactoryParse(const char *t)
 
         if ((hp = gethostbyname(addr1)) == NULL) {
             debug(28, 0) ("aclParseIpData: Bad host/IP: '%s'\n", t);
-            delete q;
-            return NULL;
+            self_destruct();
         }
 
         Q = &q;
@@ -269,7 +266,14 @@ acl_ip_data::FactoryParse(const char *t)
 
             r->addr2.s_addr = 0;
 
-            DecodeMask(mask, &r->mask);
+            if (!DecodeMask(mask, &r->mask)) {
+                debug(28, 0) ("aclParseIpData: unknown netmask '%s' in '%s'\n", mask, t);
+                delete r;
+                *Q = NULL;
+                self_destruct();
+                continue;
+            }
+
 
             Q = &r->next;
 
@@ -278,8 +282,7 @@ acl_ip_data::FactoryParse(const char *t)
 
         if (*Q != NULL) {
             debug(28, 0) ("aclParseIpData: Bad host/IP: '%s'\n", t);
-            delete q;
-            return NULL;
+            self_destruct();
         }
 
         return q;
@@ -287,28 +290,25 @@ acl_ip_data::FactoryParse(const char *t)
 
     /* Decode addr1 */
     if (!safe_inet_addr(addr1, &q->addr1)) {
-        debug(28, 0) ("%s line %d: %s\n",
-                      cfg_filename, config_lineno, config_input_line);
-        debug(28, 0) ("aclParseIpData: Ignoring invalid IP acl entry: unknown first address '%s'\n", addr1);
+        debug(28, 0) ("aclParseIpData: unknown first address in '%s'\n", t);
         delete q;
+        self_destruct();
         return NULL;
     }
 
     /* Decode addr2 */
     if (!safe_inet_addr(addr2, &q->addr2)) {
-        debug(28, 0) ("%s line %d: %s\n",
-                      cfg_filename, config_lineno, config_input_line);
-        debug(28, 0) ("aclParseIpData: Ignoring invalid IP acl entry: unknown second address '%s'\n", addr2);
+        debug(28, 0) ("aclParseIpData: unknown second address in '%s'\n", t);
         delete q;
+        self_desctruct();
         return NULL;
     }
 
     /* Decode mask */
     if (!DecodeMask(mask, &q->mask)) {
-        debug(28, 0) ("%s line %d: %s\n",
-                      cfg_filename, config_lineno, config_input_line);
-        debug(28, 0) ("aclParseIpData: Ignoring invalid IP acl entry: unknown netmask '%s'\n", mask);
+        debug(28, 0) ("aclParseIpData: unknown netmask '%s' in '%s'\n", mask, t);
         delete q;
+        self_destruct();
         return NULL;
     }
 
@@ -353,7 +353,7 @@ ACLIP::dump() const
 }
 
 bool
-ACLIP::valid () const
+ACLIP::empty () const
 {
     return data != NULL;
 }
index 7de38af0d5262f0423b69f08cfb1dcbc1e73d543..891b30073d4ef4c616467909d4e09ac4945380cb 100644 (file)
@@ -83,7 +83,7 @@ public:
     //    virtual bool isProxyAuth() const {return true;}
     virtual int match(ACLChecklist *checklist) = 0;
     virtual wordlist *dump() const;
-    virtual bool valid () const;
+    virtual bool empty () const;
 
 protected:
 
index 8f00cf1ded7175565fbb0354e82aaac72568e198..edf2cc3f688f5aee78489b9a7f96b64eea4da0c1 100644 (file)
@@ -98,7 +98,7 @@ ACLIdent::dump() const
 }
 
 bool
-ACLIdent::valid () const
+ACLIdent::empty () const
 {
     return data != NULL;
 }
index cb035a4c7fcbe307a28764cbbaeaa583b40a8415..ebaf97e54896535b2334f7a3faea4ce7acd13936 100644 (file)
@@ -68,7 +68,7 @@ public:
 
     virtual int match(ACLChecklist *checklist);
     virtual wordlist *dump() const;
-    virtual bool valid () const;
+    virtual bool empty () const;
     virtual ACL *clone()const;
 
 private:
index e54726c3bcace5fa7fd4ee3e6ff14c734aad214c..d8306a2aecf83dc4834480ad50ede9f0ddabe33f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLMaxConnection.cc,v 1.4 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLMaxConnection.cc,v 1.5 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -47,7 +47,7 @@ ACLMaxConnection::clone() const
     return new ACLMaxConnection(*this);
 }
 
-ACLMaxConnection::ACLMaxConnection (char const *theClass) : class_ (theClass), limit(0)
+ACLMaxConnection::ACLMaxConnection (char const *theClass) : class_ (theClass), limit(-1)
 {}
 
 ACLMaxConnection::ACLMaxConnection (ACLMaxConnection const & old) :class_ (old.class_), limit (old.limit)
@@ -62,22 +62,33 @@ ACLMaxConnection::typeString() const
     return class_;
 }
 
+bool
+ACLMaxConnection::empty () const
+{
+    return false;
+}
+
 bool
 ACLMaxConnection::valid () const
 {
-    return limit != 0;
+    return limit > 0;
 }
 
 void
 ACLMaxConnection::parse()
 {
     char *t = strtokFile();
+
+    if (!t)
+        return;
+
     limit = (atoi (t));
-    /* suck out file contents */
 
-    while ((t = strtokFile()))
+    /* suck out file contents */
 
-        ;
+    while ((t = strtokFile())) {
+        limit = 0;
+    }
 }
 
 int
index 384df07b41b3311e2b61832fef6f38a47ebed695..c28464c6054e0d9934c52fbd118d31e1fe55f5c3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACLMaxConnection.h,v 1.3 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLMaxConnection.h,v 1.4 2005/05/06 01:57:55 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -54,6 +54,7 @@ public:
     virtual void parse();
     virtual int match(ACLChecklist *checklist);
     virtual wordlist *dump() const;
+    virtual bool empty () const;
     virtual bool valid () const;
     virtual void prepareForUse();
 
index 1f85f7a3a775ec8f1457e7cae13ea7dbda18a890..de60c9016365fe82f8bccba2f5f246b40c0d4bc0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLMaxUserIP.cc,v 1.7 2005/04/18 21:52:41 hno Exp $
+ * $Id: ACLMaxUserIP.cc,v 1.8 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -49,7 +49,7 @@ ACLMaxUserIP::clone() const
     return new ACLMaxUserIP(*this);
 }
 
-ACLMaxUserIP::ACLMaxUserIP (char const *theClass) : class_ (theClass), maximum(0)
+ACLMaxUserIP::ACLMaxUserIP (char const *theClass) : class_ (theClass), maximum(-1)
 {}
 
 ACLMaxUserIP::ACLMaxUserIP (ACLMaxUserIP const & old) :class_ (old.class_), maximum (old.maximum), flags (old.flags)
@@ -64,10 +64,16 @@ ACLMaxUserIP::typeString() const
     return class_;
 }
 
+bool
+ACLMaxUserIP::empty () const
+{
+    return false;
+}
+
 bool
 ACLMaxUserIP::valid () const
 {
-    return maximum != 0;
+    return maximum > 0;
 }
 
 void
@@ -81,7 +87,7 @@ ACLMaxUserIP::parse()
     char *t = strtokFile();
 
     if (!t)
-        fatal("aclParseUserMaxIP: Malformed ACL\n");
+        return;
 
     debug(28, 5) ("aclParseUserMaxIP: First token is %s\n", t);
 
@@ -92,7 +98,7 @@ ACLMaxUserIP::parse()
     }
 
     if (!t)
-        fatal("aclParseUserMaxIP: Malformed ACL\n");
+        return;
 
     maximum = atoi(t);
 
index 30870b817d23154b22ce42e34257ebb31d28a529..02630368dadd58d30ba1a26cfa5e022c821f5dd7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACLMaxUserIP.h,v 1.5 2005/04/18 21:52:41 hno Exp $
+ * $Id: ACLMaxUserIP.h,v 1.6 2005/05/06 01:57:55 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -63,7 +63,7 @@ private:
 
     int match(auth_user_request_t *, struct IN_ADDR const &);
     char const *class_;
-    size_t maximum;
+    int maximum;
 
     struct Flags
     {
index 40d2bd1faf165af8e8760a8a50ac0a54ef2526a7..707a41735dea137c4d81499cebd8d7e88ca27e67 100644 (file)
@@ -72,18 +72,6 @@ ACLProxyAuth::typeString() const
 void
 ACLProxyAuth::parse()
 {
-    if (authenticateSchemeCount() == 0) {
-        debug(28, 0) ("aclProxyAuth::parse: IGNORING: Proxy Auth ACL '%s' "
-                      "because no authentication schemes were compiled.\n", cfgline);
-        return;
-    }
-
-    if (authenticateActiveSchemeCount() == 0) {
-        debug(28, 0) ("aclProxyAuth::parse: IGNORING: Proxy Auth ACL '%s' "
-                      "because no authentication schemes are fully configured.\n", cfgline);
-        return;
-    }
-
     data->parse();
 }
 
@@ -107,11 +95,27 @@ ACLProxyAuth::dump() const
 }
 
 bool
-ACLProxyAuth::valid () const
+ACLProxyAuth::empty () const
 {
     return data != NULL;
 }
 
+bool
+ACLProxyAuth::valid () const
+{
+    if (authenticateSchemeCount() == 0) {
+        debug(28, 0) ("Can't use proxy auth because no authentication schemes were compiled.\n");
+        return false;
+    }
+
+    if (authenticateActiveSchemeCount() == 0) {
+        debug(28, 0) ("Can't use proxy auth because no authentication schemes are fully configured.\n");
+        return false;
+    }
+
+    return true;
+}
+
 ProxyAuthNeeded ProxyAuthNeeded::instance_;
 
 ProxyAuthNeeded *
index bb5ee605610e6b2c8656ffb12702d226014b040d..e26490386c83b9533db17a766f8b8aa712b74827 100644 (file)
@@ -80,6 +80,7 @@ public:
     virtual int match(ACLChecklist *checklist);
     virtual wordlist *dump() const;
     virtual bool valid () const;
+    virtual bool empty () const;
     virtual bool requiresRequest() const {return true;}
 
     virtual ACL *clone()const;
index 35f975f4b859a44a1dc3531a2651031eb243a399..f9c5ca9fb89c19f49cc57388337afed1ce668a60 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACLStrategised.h,v 1.8 2004/12/24 08:57:59 robertc Exp $
+ * $Id: ACLStrategised.h,v 1.9 2005/05/06 01:57:55 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -65,7 +65,7 @@ public:
     virtual int match(ACLChecklist *checklist);
     virtual int match (M const &);
     virtual wordlist *dump() const;
-    virtual bool valid () const;
+    virtual bool empty () const;
     virtual ACL *clone()const;
 
 private:
@@ -160,9 +160,9 @@ ACLStrategised<MatchType>::dump() const
 
 template <class MatchType>
 bool
-ACLStrategised<MatchType>::valid () const
+ACLStrategised<MatchType>::empty () const
 {
-    return data != NULL;
+    return data == NULL;
 }
 
 template <class MatchType>
index 80c96e075d0aa2f714edcf9f0b7f5f625a6313dd..53876927eab35add337b5fa075e35804a094217e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLTimeData.cc,v 1.8 2004/12/20 16:30:32 robertc Exp $
+ * $Id: ACLTimeData.cc,v 1.9 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -190,9 +190,8 @@ ACLTimeData::parse()
             /* assume its time-of-day spec */
 
             if (sscanf(t, "%d:%d-%d:%d", &h1, &m1, &h2, &m2) < 4) {
-                debug(28, 0) ("%s line %d: %s\n",
-                              cfg_filename, config_lineno, config_input_line);
-                debug(28, 0) ("aclParseTimeSpec: IGNORING Bad time range\n");
+                debug(28, 0) ("aclParseTimeSpec: Bad time range '%s'\n", t);
+                self_destruct();
 
                 if (q != this)
                     delete q;
@@ -214,9 +213,8 @@ ACLTimeData::parse()
             weekbits = 0;
 
             if (q->start > q->stop) {
-                debug(28, 0) ("%s line %d: %s\n",
-                              cfg_filename, config_lineno, config_input_line);
-                debug(28, 0) ("aclParseTimeSpec: IGNORING Reversed time range\n");
+                debug(28, 0) ("aclParseTimeSpec: Reversed time range\n");
+                self_destruct();
 
                 if (q != this)
                     delete q;
index f9e3f4133b66a88ada4d9d6aa74253bf47e34961..c337197dd02f8c864a8f0ff81d89b49bf58bc699 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: AuthUserRequest.cc,v 1.3 2005/04/18 21:52:41 hno Exp $
+ * $Id: AuthUserRequest.cc,v 1.4 2005/05/06 01:57:55 hno Exp $
  *
  * DO NOT MODIFY NEXT 2 LINES:
  * arch-tag: 6803fde1-d5a2-4c29-9034-1c0c9f650eb4
@@ -304,7 +304,7 @@ authenticateAuthUserRequestClearIp(auth_user_request_t * auth_user_request)
         auth_user_request->user()->clearIp();
 }
 
-size_t
+int
 authenticateAuthUserRequestIPCount(auth_user_request_t * auth_user_request)
 {
     assert(auth_user_request);
index f93352ce3a8522483a317d31224e79bd979cf163..f1fffeb7e15300719f9a3877df8e65f9a1d9ad3b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: AuthUserRequest.h,v 1.2 2005/04/18 21:52:41 hno Exp $
+ * $Id: AuthUserRequest.h,v 1.3 2005/05/06 01:57:55 hno Exp $
  *
  * DO NOT MODIFY NEXT 2 LINES:
  * arch-tag: 674533af-8b21-4641-b71a-74c4639072a0
@@ -133,7 +133,7 @@ extern void authenticateAddTrailer(HttpReply *, auth_user_request_t *, HttpReque
 
 extern void authenticateAuthUserRequestRemoveIp(auth_user_request_t *, struct IN_ADDR);
 extern void authenticateAuthUserRequestClearIp(auth_user_request_t *);
-extern size_t authenticateAuthUserRequestIPCount(auth_user_request_t *);
+extern int authenticateAuthUserRequestIPCount(auth_user_request_t *);
 extern int authenticateDirection(auth_user_request_t *);
 
 extern int authenticateUserAuthenticated(auth_user_request_t *);
index 54c34a90ddaf91dc015e0c418faea4c051763bb8..3a063922143bb59e6d89ae9391a65f82c7775808 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ExternalACL.h,v 1.7 2005/03/30 23:08:19 hno Exp $
+ * $Id: ExternalACL.h,v 1.8 2005/05/06 01:57:55 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -80,6 +80,7 @@ public:
     virtual bool isProxyAuth() const;
     virtual wordlist *dump() const;
     virtual bool valid () const;
+    virtual bool empty () const;
 
 protected:
     static Prototype RegistryProtoype;
index d97d46b0e0d0f33ed8d0eef1fbd313be2fdb26cc..08904ac62d3235a43b698db44a4db42c1b113168 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: acl.cc,v 1.314 2004/08/30 05:12:31 robertc Exp $
+ * $Id: acl.cc,v 1.315 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -77,6 +77,11 @@ ACL::Factory (char const *type)
 
 ACL::ACL () {}
 
+bool ACL::valid () const
+{
+    return true;
+}
+
 void
 ACL::ParseAclLine(ACL ** head)
 {
@@ -89,9 +94,8 @@ ACL::ParseAclLine(ACL ** head)
     /* snarf the ACL name */
 
     if ((t = strtok(NULL, w_space)) == NULL) {
-        debug(28, 0) ("%s line %d: %s\n",
-                      cfg_filename, config_lineno, config_input_line);
         debug(28, 0) ("aclParseAclLine: missing ACL name.\n");
+        self_destruct();
         return;
     }
 
@@ -100,16 +104,14 @@ ACL::ParseAclLine(ACL ** head)
     char *theType;
 
     if ((theType = strtok(NULL, w_space)) == NULL) {
-        debug(28, 0) ("%s line %d: %s\n",
-                      cfg_filename, config_lineno, config_input_line);
         debug(28, 0) ("aclParseAclLine: missing ACL type.\n");
+        self_destruct();
         return;
     }
 
     if (!Prototype::Registered (theType)) {
-        debug(28, 0) ("%s line %d: %s\n",
-                      cfg_filename, config_lineno, config_input_line);
         debug(28, 0) ("aclParseAclLine: Invalid ACL type '%s'\n", theType);
+        self_destruct();
         return;
     }
 
@@ -121,7 +123,8 @@ ACL::ParseAclLine(ACL ** head)
         new_acl = 1;
     } else {
         if (strcmp (A->typeString(),theType) ) {
-            debug(28, 0) ("aclParseAclLine: ACL '%s' already exists with different type, skipping.\n", A->name);
+            debug(28, 0) ("aclParseAclLine: ACL '%s' already exists with different type.\n", A->name);
+            self_destruct();
             return;
         }
 
@@ -146,13 +149,14 @@ ACL::ParseAclLine(ACL ** head)
     if (!new_acl)
         return;
 
-    if (!A->valid()) {
-        debug(28, 0) ("aclParseAclLine: IGNORING invalid ACL: %s\n",
+    if (A->empty()) {
+        debug(28, 0) ("Warning: empty ACL: %s\n",
                       A->cfgline);
-        delete A;
-        /* Do we need this? */
-        A = NULL;
-        return;
+    }
+
+    if (!A->valid()) {
+        fatalf("ERROR: Invalid ACL: %s\n",
+               A->cfgline);
     }
 
     /* append */
@@ -356,10 +360,9 @@ aclParseAclList(acl_list ** head)
         a = ACL::FindByName(t);
 
         if (a == NULL) {
-            debug(28, 0) ("%s line %d: %s\n",
-                          cfg_filename, config_lineno, config_input_line);
             debug(28, 0) ("aclParseAccessLine: ACL name '%s' not found.\n", t);
             delete L;
+            self_destruct();
             continue;
         }
 
index 6b82af428891a803222492dfd42566d695a1e49b..87daacc88d27bc265f1ff0d8bac20fc4eb04dc79 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.472 2005/05/01 08:11:47 serassio Exp $
+ * $Id: cache_cf.cc,v 1.473 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -133,6 +133,7 @@ static void parse_b_size_t(size_t * var);
 void
 self_destruct(void)
 {
+    shutting_down = 1;
     fatalf("Bungled %s line %d: %s",
            cfg_filename, config_lineno, config_input_line);
 }
index 0a9b5b7a674b4b933a99e402bf747cfbeae2185a..9141e756d6ca134153e3e94e2c269071ca50a5f4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: external_acl.cc,v 1.62 2005/03/30 23:08:19 hno Exp $
+ * $Id: external_acl.cc,v 1.63 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 82    External ACL
  * AUTHOR: Henrik Nordstrom, MARA Systems AB
@@ -53,6 +53,7 @@
 #endif
 #include "client_side.h"
 #include "HttpRequest.h"
+#include "authenticate.h"
 
 #ifndef DEFAULT_EXTERNAL_ACL_TTL
 #define DEFAULT_EXTERNAL_ACL_TTL 1 * 60 * 60
@@ -575,6 +576,30 @@ ACLExternal::parse()
     }
 }
 
+bool
+ACLExternal::valid () const
+{
+    if (data->def->require_auth) {
+        if (authenticateSchemeCount() == 0) {
+            debug(28, 0) ("Can't use proxy auth because no authentication schemes were compiled.\n");
+            return false;
+        }
+
+        if (authenticateActiveSchemeCount() == 0) {
+            debug(28, 0) ("Can't use proxy auth because no authentication schemes are fully configured.\n");
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool
+ACLExternal::empty () const
+{
+    return false;
+}
+
 ACLExternal::~ACLExternal()
 {
     cbdataFree(data);
@@ -1306,12 +1331,6 @@ ACLExternal::typeString() const
     return class_;
 }
 
-bool
-ACLExternal::valid () const
-{
-    return data != NULL;
-}
-
 bool
 ACLExternal::isProxyAuth() const
 {
index 1babe749267e36ce12889f1f0020e1fee3e51ecb..4a4c3c76adec513c61f9b81da4d163799a30d3ba 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.255 2005/04/25 18:43:00 serassio Exp $
+ * $Id: tools.cc,v 1.256 2005/05/06 01:57:55 hno Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -359,9 +359,11 @@ death(int sig)
 
     storeDirWriteCleanLogs(0);
 
-    PrintRusage();
+    if (!shutting_down) {
+        PrintRusage();
 
-    dumpMallocStats();
+        dumpMallocStats();
+    }
 
     if (squid_curtime - SQUID_RELEASE_TIME < 864000) {
         /* skip if more than 10 days old */
@@ -452,7 +454,7 @@ fatal(const char *message)
     fatal_common(message);
 
     if (shutting_down)
-        exit(0);
+        exit(1);
     else
         abort();
 }