]> git.ipfire.org Git - thirdparty/squid.git/commit - src/http.cc
Minimize direct comparisons with ACCESS_ALLOWED and ACCESS_DENIED.
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 26 Jun 2017 00:10:34 +0000 (18:10 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 26 Jun 2017 00:10:34 +0000 (18:10 -0600)
commit06bf53844a91f9ec4d6a56f0c0a73317f964edc5
tree4da382f694c9f96f853665822dba988be4b2f67e
parentdb59367a06fa5bdd524be1a8491b24dd9aa4e52b
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
30 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/auth/UserRequest.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/http/Stream.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