~squid/squid/trunk

« back to all changes in this revision

Viewing changes to src/clients/FtpClient.cc

  • Committer: Amos Jeffries
  • Author(s): Alex Rousskov
  • Date: 2017-06-30 06:37:58 UTC
  • Revision ID: squid3@treenet.co.nz-20170630063758-9tf7ju0xjq3fa168
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

Show diffs side-by-side

added added

removed removed

Lines of Context:
705
705
        bool doEpsv = true;
706
706
        if (Config.accessList.ftp_epsv) {
707
707
            ACLFilledChecklist checklist(Config.accessList.ftp_epsv, fwd->request, NULL);
708
 
            doEpsv = (checklist.fastCheck() == ACCESS_ALLOWED);
 
708
            doEpsv = checklist.fastCheck().allowed();
709
709
        }
710
710
        if (!doEpsv) {
711
711
            debugs(9, 5, "EPSV support manually disabled. Sending PASV for FTP Channel (" << ctrl.conn->remote <<")");