]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
New myportname ACL for matching the accepting port name
authorhno <>
Mon, 14 Jan 2008 20:19:48 +0000 (20:19 +0000)
committerhno <>
Mon, 14 Jan 2008 20:19:48 +0000 (20:19 +0000)
also documents the name= port option which was previously implemented but unused

src/ACLMyPortName.cc [new file with mode: 0644]
src/ACLMyPortName.h [new file with mode: 0644]
src/Makefile.am
src/Makefile.in
src/cache_cf.cc
src/cf.data.pre

diff --git a/src/ACLMyPortName.cc b/src/ACLMyPortName.cc
new file mode 100644 (file)
index 0000000..44a309d
--- /dev/null
@@ -0,0 +1,63 @@
+
+/*
+ * $Id: ACLMyPortName.cc,v 1.1 2008/01/14 13:19:48 hno Exp $
+ *
+ *
+ * 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 <robertc@squid-cache.org>
+ */
+
+#include "squid.h"
+#include "ACLMyPortName.h"
+#include "ACLStringData.h"
+#include "ACLChecklist.h"
+
+/* explicit template instantiation required for some systems */
+
+template class ACLStrategised<const char *>;
+
+ACL::Prototype ACLMyPortName::RegistryProtoype(&ACLMyPortName::RegistryEntry_, "myportname");
+
+ACLStrategised<const char *> ACLMyPortName::RegistryEntry_(new ACLStringData, ACLMyPortNameStrategy::Instance(), "myportname");
+
+int
+ACLMyPortNameStrategy::match (ACLData<MatchType> * &data, ACLChecklist *checklist)
+{
+    if (checklist->conn() != NULL)
+       return data->match (checklist->conn()->port->name);
+    return 0;
+}
+
+ACLMyPortNameStrategy *
+ACLMyPortNameStrategy::Instance()
+{
+    return &Instance_;
+}
+
+ACLMyPortNameStrategy ACLMyPortNameStrategy::Instance_;
diff --git a/src/ACLMyPortName.h b/src/ACLMyPortName.h
new file mode 100644 (file)
index 0000000..ae6b8df
--- /dev/null
@@ -0,0 +1,67 @@
+
+/*
+ * $Id: ACLMyPortName.h,v 1.1 2008/01/14 13:19:48 hno Exp $
+ *
+ *
+ * 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 <robertc@squid-cache.org>
+ */
+
+#ifndef SQUID_ACLMYPORTNAME_H
+#define SQUID_ACLMYPORTNAME_H
+#include "ACLStrategy.h"
+#include "ACLStrategised.h"
+
+class ACLMyPortNameStrategy : public ACLStrategy<const char *>
+{
+
+public:
+    virtual int match (ACLData<MatchType> * &, ACLChecklist *);
+    static ACLMyPortNameStrategy *Instance();
+    /* Not implemented to prevent copies of the instance. */
+    /* Not private to prevent brain dead g+++ warnings about
+     * private constructors with no friends */
+    ACLMyPortNameStrategy(ACLMyPortNameStrategy const &);
+
+private:
+    static ACLMyPortNameStrategy Instance_;
+    ACLMyPortNameStrategy(){}
+
+    ACLMyPortNameStrategy&operator=(ACLMyPortNameStrategy const &);
+};
+
+class ACLMyPortName
+{
+
+private:
+    static ACL::Prototype RegistryProtoype;
+    static ACLStrategised<const char *> RegistryEntry_;
+};
+
+#endif /* SQUID_ACLMYPORTNAME_H */
index 97d55de34b32a339ba8814890241914b3ef78684..884444c2d366054f2bfa1b9e2dde5ba4ae7b87a2 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.197 2007/12/27 15:48:53 hno Exp $
+#  $Id: Makefile.am,v 1.198 2008/01/14 13:19:48 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -337,6 +337,8 @@ squid_ACLSOURCES = \
        ACLMyIP.h \
        ACLMyPort.cc \
        ACLMyPort.h \
+       ACLMyPortName.cc \
+       ACLMyPortName.h \
        ACLProtocol.cc \
        ACLProtocol.h \
        ACLProtocolData.cc \
index eacb83af752d252ebe7983c8c9c5c54823947f30..5e3c2b7add1fbf7871340bd07f454bc38988b9eb 100644 (file)
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.453 2007/12/27 15:50:00 hno Exp $
+#  $Id: Makefile.in,v 1.454 2008/01/14 13:19:48 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -187,10 +187,10 @@ am__squid_SOURCES_DIST = access_log.cc AccessLogEntry.h acl.cc \
        ACLMaxConnection.cc ACLMaxConnection.h ACLMaxUserIP.cc \
        ACLMaxUserIP.h ACLMethod.cc ACLMethod.h ACLMethodData.cc \
        ACLMethodData.h ACLMyIP.cc ACLMyIP.h ACLMyPort.cc ACLMyPort.h \
-       ACLProtocol.cc ACLProtocol.h ACLProtocolData.cc \
-       ACLProtocolData.h ACLProxyAuth.cc ACLProxyAuth.h ACLReferer.cc \
-       ACLReferer.h ACLRegexData.cc ACLRegexData.h \
-       ACLReplyHeaderStrategy.h ACLReplyMIMEType.cc \
+       ACLMyPortName.cc ACLMyPortName.h ACLProtocol.cc ACLProtocol.h \
+       ACLProtocolData.cc ACLProtocolData.h ACLProxyAuth.cc \
+       ACLProxyAuth.h ACLReferer.cc ACLReferer.h ACLRegexData.cc \
+       ACLRegexData.h ACLReplyHeaderStrategy.h ACLReplyMIMEType.cc \
        ACLReplyMIMEType.h ACLHTTPRepHeader.cc ACLHTTPRepHeader.h \
        ACLHTTPReqHeader.cc ACLHTTPReqHeader.h \
        ACLRequestHeaderStrategy.h ACLRequestMIMEType.cc \
@@ -281,16 +281,16 @@ am__objects_6 = $(am__objects_5) ACLASN.$(OBJEXT) ACLBrowser.$(OBJEXT) \
        ACLIntRange.$(OBJEXT) ACLIP.$(OBJEXT) \
        ACLMaxConnection.$(OBJEXT) ACLMaxUserIP.$(OBJEXT) \
        ACLMethod.$(OBJEXT) ACLMethodData.$(OBJEXT) ACLMyIP.$(OBJEXT) \
-       ACLMyPort.$(OBJEXT) ACLProtocol.$(OBJEXT) \
-       ACLProtocolData.$(OBJEXT) ACLProxyAuth.$(OBJEXT) \
-       ACLReferer.$(OBJEXT) ACLRegexData.$(OBJEXT) \
-       ACLReplyMIMEType.$(OBJEXT) ACLHTTPRepHeader.$(OBJEXT) \
-       ACLHTTPReqHeader.$(OBJEXT) ACLRequestMIMEType.$(OBJEXT) \
-       ACLSourceDomain.$(OBJEXT) ACLSourceIP.$(OBJEXT) \
-       ACLStrategised.$(OBJEXT) ACLStringData.$(OBJEXT) \
-       ACLTime.$(OBJEXT) ACLTimeData.$(OBJEXT) ACLUrl.$(OBJEXT) \
-       ACLUrlPath.$(OBJEXT) ACLUrlPort.$(OBJEXT) \
-       ACLUserData.$(OBJEXT)
+       ACLMyPort.$(OBJEXT) ACLMyPortName.$(OBJEXT) \
+       ACLProtocol.$(OBJEXT) ACLProtocolData.$(OBJEXT) \
+       ACLProxyAuth.$(OBJEXT) ACLReferer.$(OBJEXT) \
+       ACLRegexData.$(OBJEXT) ACLReplyMIMEType.$(OBJEXT) \
+       ACLHTTPRepHeader.$(OBJEXT) ACLHTTPReqHeader.$(OBJEXT) \
+       ACLRequestMIMEType.$(OBJEXT) ACLSourceDomain.$(OBJEXT) \
+       ACLSourceIP.$(OBJEXT) ACLStrategised.$(OBJEXT) \
+       ACLStringData.$(OBJEXT) ACLTime.$(OBJEXT) \
+       ACLTimeData.$(OBJEXT) ACLUrl.$(OBJEXT) ACLUrlPath.$(OBJEXT) \
+       ACLUrlPort.$(OBJEXT) ACLUserData.$(OBJEXT)
 am__objects_7 = comm_select.$(OBJEXT) comm_select_win32.$(OBJEXT) \
        comm_poll.$(OBJEXT) comm_epoll.$(OBJEXT) comm_kqueue.$(OBJEXT)
 am__objects_8 = delay_pools.$(OBJEXT) DelayId.$(OBJEXT) \
@@ -2007,6 +2007,8 @@ squid_ACLSOURCES = \
        ACLMyIP.h \
        ACLMyPort.cc \
        ACLMyPort.h \
+       ACLMyPortName.cc \
+       ACLMyPortName.h \
        ACLProtocol.cc \
        ACLProtocol.h \
        ACLProtocolData.cc \
@@ -4704,6 +4706,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ACLMethodData.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ACLMyIP.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ACLMyPort.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ACLMyPortName.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ACLProtocol.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ACLProtocolData.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ACLProxyAuth.Po@am__quote@
index cc8f3e559d0b13edb0930df6785b92f816e36120..c0c626bab4428f44af21abc34188316810c83fe7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.533 2008/01/11 02:38:59 amosjeffries Exp $
+ * $Id: cache_cf.cc,v 1.534 2008/01/14 13:19:48 hno Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -2792,6 +2792,7 @@ parse_http_port_specification(http_port_list * s, char *token)
     char *junk = NULL;
 
     s->disable_pmtu_discovery = DISABLE_PMTU_OFF;
+    s->name = strdup(token);
 
 #if USE_IPV6
     if (*token == '[') {
index 34b1cd21fe0ba6956f52ab366f3ec22f27035bdd..358a239b8b8d8463c0da52733b42dbcc909e179a 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.492 2007/12/29 18:20:22 hno Exp $
+# $Id: cf.data.pre,v 1.493 2008/01/14 13:19:48 hno Exp $
 #
 # SQUID Web Proxy Cache                http://www.squid-cache.org/
 # ----------------------------------------------------------
@@ -925,6 +925,9 @@ DOC_START
                        sporadically hang or never complete requests set
                        disable-pmtu-discovery option to 'transparent'.
 
+          name=        Specifies a internal name for the port. Defaults to
+                       the port specification (port or addr:port)
+
        If you run Squid on a dual-homed machine with an internal
        and an external interface we recommend you to specify the
        internal address:port in http_port. This way Squid will only be
@@ -1037,6 +1040,9 @@ DOC_START
           vport=NN     As above, but uses specified port number rather
                        than the https_port number. Implies accel.
 
+          name=        Specifies a internal name for the port. Defaults to
+                       the port specification (port or addr:port)
+
 DOC_END
 
 NAME: tcp_outgoing_tos tcp_outgoing_ds tcp_outgoing_dscp