]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Support "file" syntax for 'squid_error' and 'has' ACL parameters (#874)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Wed, 4 Aug 2021 22:04:38 +0000 (22:04 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 12 Aug 2021 03:27:44 +0000 (03:27 +0000)
The 'squid_error' and 'has' are the only ACLs that do not support
loading their parameters from a file using the "path/filename" syntax.
We see no justification for this exception, and it stands in the way of
(unrelated) configuration improvements we are working on (that will,
among other things, prevent such accidents from happening again).

This change causes no upgrade problems because it does not change
handling of previously accepted configurations. It only expands the set
of acceptable configurations, better matching documentation and admin
expectations with regard to universal "path/filename" syntax support.

src/acl/HasComponentData.cc
src/acl/SquidErrorData.cc

index 66142d5277e92964c0f2ea006a731badd5eb209b..1197edfb9dc21b376b67e12c2fa876f8df5dbc65 100644 (file)
@@ -23,18 +23,20 @@ ACLHasComponentData::ACLHasComponentData()
 void
 ACLHasComponentData::parse()
 {
-    const char *tok = ConfigParser::NextToken();
+    const auto tok = ConfigParser::strtokFile();
     if (!tok) {
         debugs(28, DBG_CRITICAL, "FATAL: \"has\" acl argument missing");
         self_destruct();
         return;
     }
-    if (ConfigParser::PeekAtToken()) {
+
+    parseComponent(tok);
+
+    if (ConfigParser::strtokFile()) {
         debugs(28, DBG_CRITICAL, "FATAL: multiple components not supported for \"has\" acl");
         self_destruct();
         return;
     }
-    parseComponent(tok);
 }
 
 bool
index ad7853159fcfae3c38aa3d153824ccdcd2bc5134..6c59efe99cf772666bf7e01ae4350a25c703e7d1 100644 (file)
@@ -47,7 +47,7 @@ ACLSquidErrorData::dump() const
 void
 ACLSquidErrorData::parse()
 {
-    while (char *token = ConfigParser::NextToken()) {
+    while (const auto token = ConfigParser::strtokFile()) {
         err_type err = errorTypeByName(token);
 
         if (err < ERR_MAX)