From: Eduard Bagdasaryan Date: Wed, 4 Aug 2021 22:04:38 +0000 (+0000) Subject: Support "file" syntax for 'squid_error' and 'has' ACL parameters (#874) X-Git-Tag: SQUID_6_0_1~302 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1dc0221b91c31169001a5c2c17e87fa1713de6ee;p=thirdparty%2Fsquid.git Support "file" syntax for 'squid_error' and 'has' ACL parameters (#874) 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. --- diff --git a/src/acl/HasComponentData.cc b/src/acl/HasComponentData.cc index 66142d5277..1197edfb9d 100644 --- a/src/acl/HasComponentData.cc +++ b/src/acl/HasComponentData.cc @@ -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 diff --git a/src/acl/SquidErrorData.cc b/src/acl/SquidErrorData.cc index ad7853159f..6c59efe99c 100644 --- a/src/acl/SquidErrorData.cc +++ b/src/acl/SquidErrorData.cc @@ -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)