]> git.ipfire.org Git - thirdparty/squid.git/commit
Remove AclMatchedName from ACL::ParseAclLine() (#1642)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 28 Jan 2024 09:51:37 +0000 (09:51 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 29 Jan 2024 15:44:31 +0000 (15:44 +0000)
commitb58181364a8fe1bdc0be705476bb9dfab2192979
tree401cbe117167258d6b60925da0b64e541f7c965a
parent3f045e25d2d4d543a0e7bc5423b3922d9441a54a
Remove AclMatchedName from ACL::ParseAclLine() (#1642)

ACL parsing code needs to know the aclname parameter of the being-parsed
acl directive to report various errors. Most admins recognize their ACLs
by these names so reporting aclnames improves UX. Since before 1999
commit b6a2f15, Squid used a "temporary" and "ugly" trick that supplied
aclname via the unrelated global variable called AclMatchedName (which
has its own set of problems). Some ACL parsing code used AclMatchedName
in cache.log messages, but most ACL-related problems were still reported
without that information.

Passing ACL::name to each parsing-related function via an extra
parameter is not just ugly but impractical because some the low-level
parsing functions should not really know about ACLs. Instead, we reuse
existing CodeContext mechanism to report parsing context information (in
this case -- aclname).

We plan to enhance parsing context to cover directives other than "acl"
(without modifying every directive parser, of course), but this first
small step significantly reduces configuration code exposure to
AclMatchedName, unblocking ACL-related smooth reconfiguration
improvements.
12 files changed:
src/acl/Acl.cc
src/acl/Node.h
src/acl/ProtocolData.cc
src/acl/SplayInserter.h
src/base/CodeContext.h
src/external_acl.cc
test-suite/squidconf/bad-acl-dstdomain-dupe.conf
test-suite/squidconf/bad-acl-dstdomain-dupe.conf.instructions
test-suite/squidconf/bad-acl-http-status-dupe.conf
test-suite/squidconf/bad-acl-http-status-dupe.conf.instructions
test-suite/squidconf/bad-acl-src-dupe.conf
test-suite/squidconf/bad-acl-src-dupe.conf.instructions