From 65092baf85eaf3802db6f69f527ce4d0bf2840c7 Mon Sep 17 00:00:00 2001 From: hno <> Date: Sun, 8 May 2005 12:36:45 +0000 Subject: [PATCH] Bug #1166: Configuration confusing on empty ACLS Finished and bugfixed implementation --- src/ACLARP.cc | 4 ++-- src/ACLCertificateData.cc | 7 ++++++- src/ACLCertificateData.h | 3 ++- src/ACLData.h | 7 ++++--- src/ACLDestinationDomain.cc | 4 ++-- src/ACLDomainData.cc | 8 +++++++- src/ACLDomainData.h | 3 ++- src/ACLExtUser.cc | 4 ++-- src/ACLIP.cc | 2 +- src/ACLIdent.cc | 2 +- src/ACLIntRange.cc | 8 +++++++- src/ACLIntRange.h | 3 ++- src/ACLMethodData.cc | 8 +++++++- src/ACLMethodData.h | 3 ++- src/ACLProtocolData.cc | 8 +++++++- src/ACLProtocolData.h | 3 ++- src/ACLProxyAuth.cc | 2 +- src/ACLRegexData.cc | 7 ++++++- src/ACLRegexData.h | 3 ++- src/ACLStrategised.h | 14 +++++++++++--- src/ACLStrategy.h | 4 +++- src/ACLStringData.cc | 8 +++++++- src/ACLStringData.h | 3 ++- src/ACLTimeData.cc | 7 ++++++- src/ACLTimeData.h | 3 ++- src/ACLUserData.cc | 6 ++++++ src/ACLUserData.h | 1 + 27 files changed, 103 insertions(+), 32 deletions(-) diff --git a/src/ACLARP.cc b/src/ACLARP.cc index 8d0b96d467..8261c6b884 100644 --- a/src/ACLARP.cc +++ b/src/ACLARP.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLARP.cc,v 1.13 2005/05/06 01:57:55 hno Exp $ + * $Id: ACLARP.cc,v 1.14 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -120,7 +120,7 @@ ACLARP::typeString() const bool ACLARP::empty () const { - return data != NULL; + return data == NULL; } /* ==== BEGIN ARP ACL SUPPORT ============================================= */ diff --git a/src/ACLCertificateData.cc b/src/ACLCertificateData.cc index 1c04cb5c22..c8469da94d 100644 --- a/src/ACLCertificateData.cc +++ b/src/ACLCertificateData.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLCertificateData.cc,v 1.7 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLCertificateData.cc,v 1.8 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -120,6 +120,11 @@ ACLCertificateData::parse() values.parse(); } +bool +ACLCertificateData::empty() const +{ + return values.empty(); +} ACLData * ACLCertificateData::clone() const diff --git a/src/ACLCertificateData.h b/src/ACLCertificateData.h index bf98c0f534..d352944a4b 100644 --- a/src/ACLCertificateData.h +++ b/src/ACLCertificateData.h @@ -1,6 +1,6 @@ /* - * $Id: ACLCertificateData.h,v 1.6 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLCertificateData.h,v 1.7 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -54,6 +54,7 @@ public: bool match(SSL *); wordlist *dump(); void parse(); + bool empty() const; virtual ACLData *clone() const; char *attribute; diff --git a/src/ACLData.h b/src/ACLData.h index 96c58b0ecd..a90452befa 100644 --- a/src/ACLData.h +++ b/src/ACLData.h @@ -1,6 +1,6 @@ /* - * $Id: ACLData.h,v 1.5 2003/08/04 22:14:38 robertc Exp $ + * $Id: ACLData.h,v 1.6 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -49,8 +49,9 @@ public: virtual wordlist *dump() =0; virtual void parse() =0; virtual ACLData *clone() const =0; - virtual void prepareForUse() {}} + virtual void prepareForUse() {} -; + virtual bool empty() const =0; +}; #endif /* SQUID_ACLDATA_H */ diff --git a/src/ACLDestinationDomain.cc b/src/ACLDestinationDomain.cc index 5feddcb474..97a9d072b1 100644 --- a/src/ACLDestinationDomain.cc +++ b/src/ACLDestinationDomain.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLDestinationDomain.cc,v 1.8 2005/05/06 01:57:55 hno Exp $ + * $Id: ACLDestinationDomain.cc,v 1.9 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -106,7 +106,7 @@ ACLDestinationDomain::dump() const bool ACLDestinationDomain::empty () const { - return data != NULL; + return data == NULL; } DestinationDomainLookup DestinationDomainLookup::instance_; diff --git a/src/ACLDomainData.cc b/src/ACLDomainData.cc index 09c49e18e8..55a0f2ea7c 100644 --- a/src/ACLDomainData.cc +++ b/src/ACLDomainData.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLDomainData.cc,v 1.9 2004/12/20 16:30:32 robertc Exp $ + * $Id: ACLDomainData.cc,v 1.10 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -153,6 +153,12 @@ ACLDomainData::parse() } } +bool +ACLDomainData::empty() const +{ + return domains == NULL; +} + ACLData * ACLDomainData::clone() const diff --git a/src/ACLDomainData.h b/src/ACLDomainData.h index 23b531ef04..294f18c5bf 100644 --- a/src/ACLDomainData.h +++ b/src/ACLDomainData.h @@ -1,6 +1,6 @@ /* - * $Id: ACLDomainData.h,v 1.5 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLDomainData.h,v 1.6 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -49,6 +49,7 @@ public: bool match(char const *); wordlist *dump(); void parse(); + bool empty() const; virtual ACLData *clone() const; SplayNode *domains; diff --git a/src/ACLExtUser.cc b/src/ACLExtUser.cc index 065f0f68aa..99a00b7ea1 100644 --- a/src/ACLExtUser.cc +++ b/src/ACLExtUser.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLExtUser.cc,v 1.6 2005/05/06 01:57:55 hno Exp $ + * $Id: ACLExtUser.cc,v 1.7 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -94,7 +94,7 @@ ACLExtUser::dump() const bool ACLExtUser::empty () const { - return data != NULL; + return data == NULL; } ACL * diff --git a/src/ACLIP.cc b/src/ACLIP.cc index 23df67b1cd..3ca6fc7585 100644 --- a/src/ACLIP.cc +++ b/src/ACLIP.cc @@ -355,7 +355,7 @@ ACLIP::dump() const bool ACLIP::empty () const { - return data != NULL; + return data == NULL; } int diff --git a/src/ACLIdent.cc b/src/ACLIdent.cc index edf2cc3f68..2aa48b2eba 100644 --- a/src/ACLIdent.cc +++ b/src/ACLIdent.cc @@ -100,7 +100,7 @@ ACLIdent::dump() const bool ACLIdent::empty () const { - return data != NULL; + return data == NULL; } ACL * diff --git a/src/ACLIntRange.cc b/src/ACLIntRange.cc index ea57590fb3..0d3f499449 100644 --- a/src/ACLIntRange.cc +++ b/src/ACLIntRange.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLIntRange.cc,v 1.3 2003/10/20 12:33:01 robertc Exp $ + * $Id: ACLIntRange.cc,v 1.4 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Robert Collins @@ -70,6 +70,12 @@ ACLIntRange::parse() } } +bool +ACLIntRange::empty() const +{ + return ranges != NULL; +} + bool ACLIntRange::match(int i) { diff --git a/src/ACLIntRange.h b/src/ACLIntRange.h index 391aa374d4..9065006bed 100644 --- a/src/ACLIntRange.h +++ b/src/ACLIntRange.h @@ -1,6 +1,6 @@ /* - * $Id: ACLIntRange.h,v 1.2 2003/08/04 22:14:38 robertc Exp $ + * $Id: ACLIntRange.h,v 1.3 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -49,6 +49,7 @@ public: virtual bool match(int); virtual wordlist *dump(); virtual void parse(); + virtual bool empty() const; virtual ACLData *clone() const; private: diff --git a/src/ACLMethodData.cc b/src/ACLMethodData.cc index d355199148..193386c66f 100644 --- a/src/ACLMethodData.cc +++ b/src/ACLMethodData.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLMethodData.cc,v 1.5 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLMethodData.cc,v 1.6 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -93,6 +93,12 @@ ACLMethodData::parse() } } +bool +ACLMethodData::empty() const +{ + return values != NULL; +} + ACLData * ACLMethodData::clone() const { diff --git a/src/ACLMethodData.h b/src/ACLMethodData.h index 24ad5d540e..d394d981bc 100644 --- a/src/ACLMethodData.h +++ b/src/ACLMethodData.h @@ -1,6 +1,6 @@ /* - * $Id: ACLMethodData.h,v 1.3 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLMethodData.h,v 1.4 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -52,6 +52,7 @@ public: bool match(method_t); wordlist *dump(); void parse(); + bool empty() const; virtual ACLData *clone() const; List *values; diff --git a/src/ACLProtocolData.cc b/src/ACLProtocolData.cc index 60486f7772..f6b5eab0fc 100644 --- a/src/ACLProtocolData.cc +++ b/src/ACLProtocolData.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLProtocolData.cc,v 1.5 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLProtocolData.cc,v 1.6 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -93,6 +93,12 @@ ACLProtocolData::parse() } } +bool +ACLProtocolData::empty() const +{ + return values == NULL; +} + ACLData * ACLProtocolData::clone() const { diff --git a/src/ACLProtocolData.h b/src/ACLProtocolData.h index 0414866468..1a162e4900 100644 --- a/src/ACLProtocolData.h +++ b/src/ACLProtocolData.h @@ -1,6 +1,6 @@ /* - * $Id: ACLProtocolData.h,v 1.3 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLProtocolData.h,v 1.4 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -52,6 +52,7 @@ public: bool match(protocol_t); wordlist *dump(); void parse(); + bool empty() const; virtual ACLData *clone() const; List *values; diff --git a/src/ACLProxyAuth.cc b/src/ACLProxyAuth.cc index 707a41735d..2e35615afd 100644 --- a/src/ACLProxyAuth.cc +++ b/src/ACLProxyAuth.cc @@ -97,7 +97,7 @@ ACLProxyAuth::dump() const bool ACLProxyAuth::empty () const { - return data != NULL; + return data == NULL; } bool diff --git a/src/ACLRegexData.cc b/src/ACLRegexData.cc index 15ac98103c..24031ed80d 100644 --- a/src/ACLRegexData.cc +++ b/src/ACLRegexData.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLRegexData.cc,v 1.7 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLRegexData.cc,v 1.8 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -160,6 +160,11 @@ ACLRegexData::parse() aclParseRegexList(&data); } +bool +ACLRegexData::empty() const +{ + return data == NULL; +} ACLData * ACLRegexData::clone() const diff --git a/src/ACLRegexData.h b/src/ACLRegexData.h index a9716c7109..63bfef2822 100644 --- a/src/ACLRegexData.h +++ b/src/ACLRegexData.h @@ -1,6 +1,6 @@ /* - * $Id: ACLRegexData.h,v 1.5 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLRegexData.h,v 1.6 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -47,6 +47,7 @@ public: virtual bool match(char const *user); virtual wordlist *dump(); virtual void parse(); + virtual bool empty() const; virtual ACLData *clone() const; private: diff --git a/src/ACLStrategised.h b/src/ACLStrategised.h index f9c5ca9fb8..8bdbc69c12 100644 --- a/src/ACLStrategised.h +++ b/src/ACLStrategised.h @@ -1,6 +1,6 @@ /* - * $Id: ACLStrategised.h,v 1.9 2005/05/06 01:57:55 hno Exp $ + * $Id: ACLStrategised.h,v 1.10 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -66,6 +66,7 @@ public: virtual int match (M const &); virtual wordlist *dump() const; virtual bool empty () const; + virtual bool valid () const; virtual ACL *clone()const; private: @@ -137,6 +138,13 @@ ACLStrategised::parse() data->parse(); } +template +bool +ACLStrategised::empty() const +{ + return data->empty(); +} + template int ACLStrategised::match(ACLChecklist *checklist) @@ -160,9 +168,9 @@ ACLStrategised::dump() const template bool -ACLStrategised::empty () const +ACLStrategised::valid () const { - return data == NULL; + return matcher->valid(); } template diff --git a/src/ACLStrategy.h b/src/ACLStrategy.h index a37189d5ae..b849559bd3 100644 --- a/src/ACLStrategy.h +++ b/src/ACLStrategy.h @@ -1,6 +1,6 @@ /* - * $Id: ACLStrategy.h,v 1.2 2004/12/24 08:57:59 robertc Exp $ + * $Id: ACLStrategy.h,v 1.3 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -52,6 +52,8 @@ public: virtual bool requiresReply() const {return false;} + virtual bool valid() const {return true;} + virtual ~ACLStrategy(){}} ; diff --git a/src/ACLStringData.cc b/src/ACLStringData.cc index 9afa523449..eeada44053 100644 --- a/src/ACLStringData.cc +++ b/src/ACLStringData.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLStringData.cc,v 1.5 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLStringData.cc,v 1.6 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -110,6 +110,12 @@ ACLStringData::parse() values = values->insert(xstrdup(t), splaystrcmp); } +bool +ACLStringData::empty() const +{ + return values == NULL; +} + ACLData * ACLStringData::clone() const { diff --git a/src/ACLStringData.h b/src/ACLStringData.h index 33426e6b36..c8a87f1493 100644 --- a/src/ACLStringData.h +++ b/src/ACLStringData.h @@ -1,6 +1,6 @@ /* - * $Id: ACLStringData.h,v 1.3 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLStringData.h,v 1.4 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -53,6 +53,7 @@ public: bool match(char const *); wordlist *dump(); void parse(); + bool empty() const; virtual ACLData *clone() const; SplayNode *values; diff --git a/src/ACLTimeData.cc b/src/ACLTimeData.cc index 53876927ea..347846e690 100644 --- a/src/ACLTimeData.cc +++ b/src/ACLTimeData.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLTimeData.cc,v 1.9 2005/05/06 01:57:55 hno Exp $ + * $Id: ACLTimeData.cc,v 1.10 2005/05/08 06:36:45 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -252,6 +252,11 @@ ACLTimeData::parse() } } +bool +ACLTimeData::empty() const +{ + return false; +} ACLData * ACLTimeData::clone() const diff --git a/src/ACLTimeData.h b/src/ACLTimeData.h index 53a1c6048e..f143be2a31 100644 --- a/src/ACLTimeData.h +++ b/src/ACLTimeData.h @@ -1,6 +1,6 @@ /* - * $Id: ACLTimeData.h,v 1.4 2004/08/30 05:12:31 robertc Exp $ + * $Id: ACLTimeData.h,v 1.5 2005/05/08 06:36:45 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -52,6 +52,7 @@ public: bool match(time_t); wordlist *dump(); void parse(); + bool empty() const; virtual ACLData *clone() const; private: diff --git a/src/ACLUserData.cc b/src/ACLUserData.cc index 822f5dcf82..66c5acc393 100644 --- a/src/ACLUserData.cc +++ b/src/ACLUserData.cc @@ -163,6 +163,12 @@ ACLUserData::parse() } +bool +ACLUserData::empty() const +{ + return names == NULL; +} + ACLData * ACLUserData::clone() const { diff --git a/src/ACLUserData.h b/src/ACLUserData.h index c5354648be..2b874a54a6 100644 --- a/src/ACLUserData.h +++ b/src/ACLUserData.h @@ -49,6 +49,7 @@ public: bool match(char const *user); wordlist *dump(); void parse(); + bool empty() const; virtual ACLData *clone() const; SplayNode *names; -- 2.47.3