------------------------------------------------------------ revno: 11508 revision-id: squid3@treenet.co.nz-20110620085132-zhtf5jm6lsm8bfuz parent: squid3@treenet.co.nz-20110620075009-1n1db7m28o489xhe fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=3239 committer: Amos Jeffries branch nick: trunk timestamp: Mon 2011-06-20 20:51:32 +1200 message: Bug 3239: Rename myip/myport as localip/localport There is no actual logic change to this patch. * Document what the myip/myport actually match and use the clearer names of localip / localport. * Cleanly upgrade the ACL types when old versions are seen. * Rename all relevant code symbols to match the new names. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20110620085132-zhtf5jm6lsm8bfuz # target_branch: http://www.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: fa355333c3e5bd0fac93295cfc50fbf15864489a # timestamp: 2011-06-20 09:52:39 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20110620075009-\ # 1n1db7m28o489xhe # # Begin patch === modified file 'doc/release-notes/release-3.2.sgml' --- doc/release-notes/release-3.2.sgml 2011-06-18 07:05:06 +0000 +++ doc/release-notes/release-3.2.sgml 2011-06-20 08:51:32 +0000 @@ -448,8 +448,13 @@

New format referrer to log with the format prevously used by referer_log directive.

New format useragent to log with the format prevously used by useragent_log directive. - acl random + acl : random, localip, localport

New type random. Pseudo-randomly match requests based on a configured probability. +

Renamed myip to localip. It matches the IP which the client connected to. +

Renamed myport to localport. It matches the port which the client connected to. +

The localip/localport differ from earlier releases where they matched a mix of + of an invalid IP and port 0, the client destination IP/port or the Squid listening IP/port. + This definition is now consistent across all modes of traffic received by Squid. auth_param

New options for Basic, Digest, NTLM, Negotiate children settings. === modified file 'src/AclRegs.cc' --- src/AclRegs.cc 2011-03-02 07:27:24 +0000 +++ src/AclRegs.cc 2011-06-20 08:51:32 +0000 @@ -31,11 +31,11 @@ #include "acl/HttpStatus.h" #include "acl/IntRange.h" #include "acl/Ip.h" +#include "acl/LocalIp.h" +#include "acl/LocalPort.h" #include "acl/MaxConnection.h" #include "acl/MethodData.h" #include "acl/Method.h" -#include "acl/MyIp.h" -#include "acl/MyPort.h" #include "acl/MyPortName.h" #include "acl/PeerName.h" #include "acl/ProtocolData.h" @@ -101,10 +101,10 @@ ACLMaxConnection ACLMaxConnection::RegistryEntry_("maxconn"); ACL::Prototype ACLMethod::RegistryProtoype(&ACLMethod::RegistryEntry_, "method"); ACLStrategised ACLMethod::RegistryEntry_(new ACLMethodData, ACLMethodStrategy::Instance(), "method"); -ACL::Prototype ACLMyIP::RegistryProtoype(&ACLMyIP::RegistryEntry_, "myip"); -ACLMyIP ACLMyIP::RegistryEntry_; -ACL::Prototype ACLMyPort::RegistryProtoype(&ACLMyPort::RegistryEntry_, "myport"); -ACLStrategised ACLMyPort::RegistryEntry_(new ACLIntRange, ACLMyPortStrategy::Instance(), "myport"); +ACL::Prototype ACLLocatIP::RegistryProtoype(&ACLLocalIP::RegistryEntry_, "localip"); +ACLLocalIP ACLLocalIP::RegistryEntry_; +ACL::Prototype ACLLocalPort::RegistryProtoype(&ACLLocalPort::RegistryEntry_, "localport"); +ACLStrategised ACLLocalPort::RegistryEntry_(new ACLIntRange, ACLLocalPortStrategy::Instance(), "localport"); ACL::Prototype ACLMyPortName::RegistryProtoype(&ACLMyPortName::RegistryEntry_, "myportname"); ACLStrategised ACLMyPortName::RegistryEntry_(new ACLStringData, ACLMyPortNameStrategy::Instance(), "myportname"); ACL::Prototype ACLPeerName::RegistryProtoype(&ACLPeerName::RegistryEntry_, "peername"); === modified file 'src/acl/Acl.cc' --- src/acl/Acl.cc 2011-06-14 00:12:35 +0000 +++ src/acl/Acl.cc 2011-06-20 08:51:32 +0000 @@ -121,12 +121,6 @@ return; } - if (!Prototype::Registered (theType)) { - debugs(28, 0, "aclParseAclLine: Invalid ACL type '" << theType << "'"); - parser.destruct(); - return; - } - // Is this ACL going to work? if (strcmp(theType, "myip") != 0) { http_port_list *p = Config.Sockaddr.http; @@ -136,6 +130,8 @@ debugs(28, DBG_CRITICAL, "WARNING: 'myip' ACL is not reliable for interception proxies. Please use 'myportname' instead."); p = p->next; } + debugs(28, DBG_WARNING, "UPGRADE: ACL 'myip' type is has been renamed to 'localip' and matches the IP the client connected to."); + theType = "localip"; } else if (strcmp(theType, "myport") != 0) { http_port_list *p = Config.Sockaddr.http; while (p) { @@ -145,6 +141,15 @@ debugs(28, DBG_CRITICAL, "WARNING: 'myport' ACL is not reliable for interception proxies. Please use 'myportname' instead."); p = p->next; } + theType = "localport"; + debugs(28, DBG_WARNING, "UPGRADE: ACL 'myport' type is has been renamed to 'localport' and matches the port the client connected to."); + } + + if (!Prototype::Registered(theType)) { + debugs(28, DBG_CRITICAL, "FATAL: Invalid ACL type '" << theType << "'"); + // XXX: make this an ERROR and skip the ACL creation. We *may* die later when its use is attempted. Or may not. + parser.destruct(); + return; } if ((A = FindByName(aclname)) == NULL) { === renamed file 'src/acl/MyIp.cc' => 'src/acl/LocalIp.cc' --- src/acl/MyIp.cc 2009-03-17 02:04:14 +0000 +++ src/acl/LocalIp.cc 2011-06-20 08:51:32 +0000 @@ -34,17 +34,17 @@ */ #include "squid.h" -#include "acl/MyIp.h" +#include "acl/LocalIp.h" #include "acl/FilledChecklist.h" char const * -ACLMyIP::typeString() const +ACLLocalIP::typeString() const { - return "myip"; + return "localip"; } int -ACLMyIP::match(ACLChecklist *checklist) +ACLLocalIP::match(ACLChecklist *checklist) { return ACLIP::match (Filled(checklist)->my_addr); } @@ -53,7 +53,7 @@ ACL * -ACLMyIP::clone() const +ACLLocalIP::clone() const { - return new ACLMyIP(*this); + return new ACLocalIP(*this); } === renamed file 'src/acl/MyIp.h' => 'src/acl/LocalIp.h' --- src/acl/MyIp.h 2009-03-31 12:39:30 +0000 +++ src/acl/LocalIp.h 2011-06-20 08:51:32 +0000 @@ -32,18 +32,18 @@ * Copyright (c) 2003, Robert Collins */ -#ifndef SQUID_ACLMYIP_H -#define SQUID_ACLMYIP_H +#ifndef SQUID_ACLLOCALIP_H +#define SQUID_ACLLOCALIP_H #include "acl/Ip.h" /// \ingroup ACLAPI -class ACLMyIP : public ACLIP +class ACLLocalIP : public ACLIP { public: - MEMPROXY_CLASS(ACLMyIP); - static ACLMyIP const &RegistryEntry(); + MEMPROXY_CLASS(ACLLocalIP); + static ACLLocalIP const &RegistryEntry(); virtual char const *typeString() const; virtual int match(ACLChecklist *checklist); @@ -51,9 +51,9 @@ private: static Prototype RegistryProtoype; - static ACLMyIP RegistryEntry_; + static ACLLocalIP RegistryEntry_; }; -MEMPROXY_CLASS_INLINE(ACLMyIP); +MEMPROXY_CLASS_INLINE(ACLLocalIP); -#endif /* SQUID_ACLMYIP_H */ +#endif /* SQUID_ACLLOCALIP_H */ === renamed file 'src/acl/MyPort.cc' => 'src/acl/LocalPort.cc' --- src/acl/MyPort.cc 2009-05-11 01:44:50 +0000 +++ src/acl/LocalPort.cc 2011-06-20 08:51:32 +0000 @@ -34,20 +34,20 @@ */ #include "squid.h" -#include "acl/MyPort.h" +#include "acl/LocalPort.h" #include "acl/IntRange.h" #include "acl/Checklist.h" int -ACLMyPortStrategy::match (ACLData * &data, ACLFilledChecklist *checklist) +ACLLocalPortStrategy::match (ACLData * &data, ACLFilledChecklist *checklist) { return data->match (checklist->my_addr.GetPort()); } -ACLMyPortStrategy * -ACLMyPortStrategy::Instance() +ACLLocalPortStrategy * +ACLLocalPortStrategy::Instance() { return &Instance_; } -ACLMyPortStrategy ACLMyPortStrategy::Instance_; +ACLLocalPortStrategy ACLLocalPortStrategy::Instance_; === renamed file 'src/acl/MyPort.h' => 'src/acl/LocalPort.h' --- src/acl/MyPort.h 2009-03-08 21:53:27 +0000 +++ src/acl/LocalPort.h 2011-06-20 08:51:32 +0000 @@ -32,36 +32,36 @@ * Copyright (c) 2003, Robert Collins */ -#ifndef SQUID_ACLMYPORT_H -#define SQUID_ACLMYPORT_H +#ifndef SQUID_ACLLOCALPORT_H +#define SQUID_ACLLOCALPORT_H #include "acl/Strategy.h" #include "acl/Strategised.h" /// \ingroup ACLAPI -class ACLMyPortStrategy : public ACLStrategy +class ACLLocalPortStrategy : public ACLStrategy { public: virtual int match (ACLData * &, ACLFilledChecklist *); - static ACLMyPortStrategy *Instance(); + static ACLLocalPortStrategy *Instance(); /** * Not implemented to prevent copies of the instance. \par * Not private to prevent brain dead g+++ warnings about * private constructors with no friends */ - ACLMyPortStrategy(ACLMyPortStrategy const &); + ACLLocalPortStrategy(ACLLocalPortStrategy const &); private: - static ACLMyPortStrategy Instance_; - ACLMyPortStrategy() {} + static ACLLocalPortStrategy Instance_; + ACLLocalPortStrategy() {} - ACLMyPortStrategy&operator=(ACLMyPortStrategy const &); + ACLLocalPortStrategy&operator=(ACLLocalPortStrategy const &); }; /// \ingroup ACLAPI -class ACLMyPort +class ACLLocalPort { private: @@ -69,4 +69,4 @@ static ACLStrategised RegistryEntry_; }; -#endif /* SQUID_ACLMYPORT_H */ +#endif /* SQUID_ACLLOCALPORT_H */ === modified file 'src/acl/Makefile.am' --- src/acl/Makefile.am 2009-11-01 07:48:25 +0000 +++ src/acl/Makefile.am 2011-06-20 08:51:32 +0000 @@ -61,16 +61,16 @@ HttpStatus.h \ Ip.cc \ Ip.h \ + LocalIp.cc \ + LocalIp.h \ + LocalPort.cc \ + LocalPort.h \ MaxConnection.cc \ MaxConnection.h \ Method.cc \ MethodData.cc \ MethodData.h \ Method.h \ - MyIp.cc \ - MyIp.h \ - MyPort.cc \ - MyPort.h \ MyPortName.cc \ MyPortName.h \ PeerName.cc \ === modified file 'src/acl/Strategised.cc' --- src/acl/Strategised.cc 2009-05-11 01:44:50 +0000 +++ src/acl/Strategised.cc 2011-06-20 08:51:32 +0000 @@ -51,5 +51,5 @@ /* ACLMyPortName + ACLMyPeerName + ACLBrowser */ template class ACLStrategised; -/* ACLMyPort + ACLSslError */ +/* ACLLocalPort + ACLSslError */ template class ACLStrategised; === modified file 'src/cf.data.pre' --- src/cf.data.pre 2011-06-17 06:04:05 +0000 +++ src/cf.data.pre 2011-06-20 08:51:32 +0000 @@ -657,10 +657,10 @@ ***** ACL TYPES AVAILABLE ***** - acl aclname src ip-address/netmask ... # clients IP address [fast] - acl aclname src addr1-addr2/netmask ... # range of addresses [fast] - acl aclname dst ip-address/netmask ... # URL host's IP address [slow] - acl aclname myip ip-address/netmask ... # local socket IP address [fast] + acl aclname src ip-address/mask ... # clients IP address [fast] + acl aclname src addr1-addr2/mask ... # range of addresses [fast] + acl aclname dst ip-address/mask ... # URL host's IP address [slow] + acl aclname localip ip-address/mask ... # IP address the client connected to [fast] acl aclname arp mac-address ... (xx:xx:xx:xx:xx:xx notation) # The arp ACL requires the special configure option --enable-arp-acl. @@ -721,7 +721,9 @@ acl aclname port 80 70 21 0-1024... # destination TCP port [fast] # ranges are alloed - acl aclname myport 3128 ... # local socket TCP port [fast] + acl aclname localport 3128 ... # TCP port the client connected to [fast] + # NP: for interception mode this is usually '80' + acl aclname myportname 3128 ... # http(s)_port name [fast] acl aclname proto HTTP FTP ... # request protocol [fast]