]> git.ipfire.org Git - thirdparty/squid.git/commit
Minimize direct comparisons with ACCESS_ALLOWED and ACCESS_DENIED.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 30 Jun 2017 06:37:58 +0000 (18:37 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 30 Jun 2017 06:37:58 +0000 (18:37 +1200)
commit4745827a5ee16f6d0ed9c3ea8b194340b37cace3
treed4e06874cc46e8cea974c110232c596a5cedbd70
parentf3d3855a5255d6054ddc2324bdb3148b7c39f722
Minimize direct comparisons with ACCESS_ALLOWED and ACCESS_DENIED.

No functionality changes expected.

Added allow_t API to avoid direct comparisons with ACCESS_ALLOWED and
ACCESS_DENIED. Developers using direct comparisons eventually mishandle
exceptional ACCESS_DUNNO and ACCESS_AUTH_REQUIRED cases where neither
"allow" nor "deny" rule matched. The new API cannot fully prevent such
bugs, but should either led the developer to the right choice (usually
.allowed()) or alert the reviewer about an unusual choice (i.e.,
denied()).

The vast majority of checks use allowed(), but we could not eliminate
the remaining denied() cases ("miss_access" and "cache" directives) for
backward compatibility reasons -- previously "working" deployments may
suddenly start blocking cache misses and/or stop caching:
http://lists.squid-cache.org/pipermail/squid-dev/2017-May/008576.html
28 files changed:
src/DelayId.cc
src/FwdState.cc
src/HttpHeaderTools.cc
src/HttpReply.cc
src/HttpRequest.cc
src/Notes.cc
src/acl/Acl.h
src/acl/Tree.h
src/adaptation/AccessCheck.cc
src/adaptation/icap/Launcher.cc
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/clients/Client.cc
src/clients/FtpClient.cc
src/external_acl.cc
src/htcp.cc
src/http.cc
src/icp_v2.cc
src/log/access_log.cc
src/neighbors.cc
src/security/PeerConnector.cc
src/servers/FtpServer.cc
src/servers/Http1Server.cc
src/snmp_core.cc
src/ssl/PeekingPeerConnector.cc
src/ssl/support.cc
src/tunnel.cc