------------------------------------------------------------ revno: 12379 revision-id: squid3@treenet.co.nz-20121110035744-ytrkuj55aj9vt0f8 parent: squid3@treenet.co.nz-20121110035703-mu7tcl584h7xex1k committer: Amos Jeffries branch nick: 3.3 timestamp: Fri 2012-11-09 20:57:44 -0700 message: Ported: urllogin ACL from squid 2.7 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121110035744-ytrkuj55aj9vt0f8 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 6935ce1a2673810228c747edcc8c6ffe9b8b95d1 # timestamp: 2012-11-10 04:03:34 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121110035703-\ # mu7tcl584h7xex1k # # Begin patch === modified file 'doc/release-notes/release-3.2.sgml' --- doc/release-notes/release-3.2.sgml 2012-10-20 10:41:31 +0000 +++ doc/release-notes/release-3.2.sgml 2012-11-10 03:57:44 +0000 @@ -588,6 +588,7 @@

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. +

Ported urllogin option from Squid 2.7, to match a regex pattern on the URL login field (if any).

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. @@ -1030,10 +1031,6 @@ Missing squid.conf options available in Squid-2.7

- acl -

urllogin option not yet ported from 2.6 -

urlgroup option not yet ported from 2.6 - broken_vary_encoding

Not yet ported from 2.6 === modified file 'doc/release-notes/release-3.3.sgml' --- doc/release-notes/release-3.3.sgml 2012-11-10 03:57:03 +0000 +++ doc/release-notes/release-3.3.sgml 2012-11-10 03:57:44 +0000 @@ -271,9 +271,6 @@ Missing squid.conf options available in Squid-2.7

- acl -

urllogin option not yet ported from 2.6 - broken_vary_encoding

Not yet ported from 2.6 === modified file 'src/AclRegs.cc' --- src/AclRegs.cc 2012-08-28 13:00:30 +0000 +++ src/AclRegs.cc 2012-11-10 03:57:44 +0000 @@ -63,6 +63,7 @@ #include "acl/TimeData.h" #include "acl/Time.h" #include "acl/Url.h" +#include "acl/UrlLogin.h" #include "acl/UrlPath.h" #include "acl/UrlPort.h" #include "acl/UserData.h" @@ -130,6 +131,8 @@ ACLStrategised ACLTime::RegistryEntry_(new ACLTimeData, ACLTimeStrategy::Instance(), "time"); ACL::Prototype ACLUrl::RegistryProtoype(&ACLUrl::RegistryEntry_, "url_regex"); ACLStrategised ACLUrl::RegistryEntry_(new ACLRegexData, ACLUrlStrategy::Instance(), "url_regex"); +ACL::Prototype ACLUrlLogin::RegistryProtoype(&ACLUrlLogin::RegistryEntry_, "urllogin"); +ACLStrategised ACLUrlLogin::RegistryEntry_(new ACLRegexData, ACLUrlLoginStrategy::Instance(), "urllogin"); ACL::Prototype ACLUrlPath::LegacyRegistryProtoype(&ACLUrlPath::RegistryEntry_, "pattern"); ACL::Prototype ACLUrlPath::RegistryProtoype(&ACLUrlPath::RegistryEntry_, "urlpath_regex"); ACLStrategised ACLUrlPath::RegistryEntry_(new ACLRegexData, ACLUrlPathStrategy::Instance(), "urlpath_regex"); === modified file 'src/acl/Makefile.am' --- src/acl/Makefile.am 2012-09-25 15:36:18 +0000 +++ src/acl/Makefile.am 2012-11-10 03:57:44 +0000 @@ -98,6 +98,8 @@ Tag.h \ Url.cc \ Url.h \ + UrlLogin.cc \ + UrlLogin.h \ UrlPath.cc \ UrlPath.h \ UrlPort.cc \ === added file 'src/acl/UrlLogin.cc' --- src/acl/UrlLogin.cc 1970-01-01 00:00:00 +0000 +++ src/acl/UrlLogin.cc 2012-11-10 03:57:44 +0000 @@ -0,0 +1,56 @@ +/* + * DEBUG: section 28 Access Control + * AUTHOR: Duane Wessels + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#include "squid.h" +#include "acl/UrlLogin.h" +#include "acl/Checklist.h" +#include "acl/RegexData.h" +#include "HttpRequest.h" +#include "rfc1738.h" + +int +ACLUrlLoginStrategy::match (ACLData * &data, ACLFilledChecklist *checklist) +{ + char *esc_buf = xstrdup(checklist->request->login); + rfc1738_unescape(esc_buf); + int result = data->match(esc_buf); + safe_free(esc_buf); + return result; +} + +ACLUrlLoginStrategy * +ACLUrlLoginStrategy::Instance() +{ + return &Instance_; +} + +ACLUrlLoginStrategy ACLUrlLoginStrategy::Instance_; === added file 'src/acl/UrlLogin.h' --- src/acl/UrlLogin.h 1970-01-01 00:00:00 +0000 +++ src/acl/UrlLogin.h 2012-11-10 03:57:44 +0000 @@ -0,0 +1,73 @@ + +/* + * $Id$ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + * + * Copyright (c) 2003, Robert Collins + */ + +#ifndef SQUID_ACLURLLOGIN_H +#define SQUID_ACLURLLOGIN_H + +#include "acl/Acl.h" +#include "acl/Data.h" +#include "acl/Strategy.h" +#include "acl/Strategised.h" + +class ACLUrlLoginStrategy : public ACLStrategy +{ + +public: + virtual int match (ACLData * &, ACLFilledChecklist *); + virtual bool requiresRequest() const {return true;} + + static ACLUrlLoginStrategy *Instance(); + /* Not implemented to prevent copies of the instance. */ + /* Not private to prevent brain dead g+++ warnings about + * private constructors with no friends */ + ACLUrlLoginStrategy(ACLUrlLoginStrategy const &); + +private: + static ACLUrlLoginStrategy Instance_; + ACLUrlLoginStrategy() {} + + ACLUrlLoginStrategy&operator=(ACLUrlLoginStrategy const &); +}; + +class ACLUrlLogin +{ + +public: + static ACL::Prototype RegistryProtoype; + static ACL::Prototype LegacyRegistryProtoype; + static ACLStrategised RegistryEntry_; +}; + +#endif /* SQUID_ACLURLLOGIN_H */ === modified file 'src/cf.data.pre' --- src/cf.data.pre 2012-10-20 11:29:46 +0000 +++ src/cf.data.pre 2012-11-10 03:57:44 +0000 @@ -754,6 +754,8 @@ acl aclname url_regex [-i] ^http:// ... # regex matching on whole URL [fast] + acl aclname urllogin [-i] [^a-zA-Z0-9] ... + # regex matching on URL login field acl aclname urlpath_regex [-i] \.gif$ ... # regex matching on URL path [fast]