--------------------- PatchSet 11910 Date: 2008/01/22 14:36:46 Author: hno Branch: SQUID_2_7 Tag: (none) Log: MFC: New myportname ACL for matching the accepting port name also documents the name= port option which was previously implemented but unused Members: src/acl.c:1.320->1.320.2.1 src/cache_cf.c:1.480->1.480.2.1 src/cf.data.pre:1.450.2.3->1.450.2.4 src/enums.h:1.245->1.245.2.1 Index: squid/src/acl.c =================================================================== RCS file: /cvsroot/squid/squid/src/acl.c,v retrieving revision 1.320 retrieving revision 1.320.2.1 diff -u -r1.320 -r1.320.2.1 --- squid/src/acl.c 14 Mar 2007 22:43:24 -0000 1.320 +++ squid/src/acl.c 22 Jan 2008 14:36:46 -0000 1.320.2.1 @@ -1,6 +1,6 @@ /* - * $Id: acl.c,v 1.320 2007/03/14 22:43:24 hno Exp $ + * $Id: acl.c,v 1.320.2.1 2008/01/22 14:36:46 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -140,6 +140,8 @@ return ACL_URL_PORT; if (!strcmp(s, "myport")) return ACL_MY_PORT; + if (!strcmp(s, "myportname")) + return ACL_MY_PORT_NAME; if (!strcmp(s, "maxconn")) return ACL_MAXCONN; #if USE_IDENT @@ -236,6 +238,8 @@ return "port"; if (type == ACL_MY_PORT) return "myport"; + if (type == ACL_MY_PORT_NAME) + return "myportname"; if (type == ACL_MAXCONN) return "maxconn"; #if USE_IDENT @@ -1034,6 +1038,9 @@ case ACL_MY_PORT: aclParsePortRange(&A->data); break; + case ACL_MY_PORT_NAME: + aclParseWordList(&A->data); + break; #if USE_IDENT case ACL_IDENT: aclParseUserList(&A->data); @@ -1896,6 +1903,13 @@ case ACL_MY_PORT: return aclMatchIntegerRange(ae->data, (int) checklist->my_port); /* NOTREACHED */ + case ACL_MY_PORT_NAME: + if (!checklist->conn) + return 0; + if (!checklist->conn->port) + return 0; + return aclMatchWordList(ae->data, checklist->conn->port->name); + /* NOTREACHED */ #if USE_IDENT case ACL_IDENT: if (checklist->rfc931[0]) { @@ -2567,6 +2581,9 @@ case ACL_MY_PORT: aclDestroyIntRange(a->data); break; + case ACL_MY_PORT_NAME: + wordlistDestroy((wordlist **) (void *) &a->data); + break; case ACL_EXTERNAL: aclDestroyExternal(&a->data); break; @@ -2999,6 +3016,8 @@ case ACL_URL_PORT: case ACL_MY_PORT: return aclDumpIntRangeList(a->data); + case ACL_MY_PORT_NAME: + return wordlistDup(a->data); case ACL_TYPE: return aclDumpType(a->data); case ACL_PROTO: Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid/squid/src/cache_cf.c,v retrieving revision 1.480 retrieving revision 1.480.2.1 diff -u -r1.480 -r1.480.2.1 --- squid/src/cache_cf.c 13 Dec 2007 01:25:34 -0000 1.480 +++ squid/src/cache_cf.c 22 Jan 2008 14:36:46 -0000 1.480.2.1 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.480 2007/12/13 01:25:34 hno Exp $ + * $Id: cache_cf.c,v 1.480.2.1 2008/01/22 14:36:46 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -2758,6 +2758,7 @@ const struct hostent *hp; unsigned short port = 0; char *t; + s->name = xstrdup(token); if ((t = strchr(token, ':'))) { /* host:port */ host = token; Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid/squid/src/cf.data.pre,v retrieving revision 1.450.2.3 retrieving revision 1.450.2.4 diff -u -r1.450.2.3 -r1.450.2.4 --- squid/src/cf.data.pre 22 Jan 2008 14:34:31 -0000 1.450.2.3 +++ squid/src/cf.data.pre 22 Jan 2008 14:36:46 -0000 1.450.2.4 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.450.2.3 2008/01/22 14:34:31 hno Exp $ +# $Id: cf.data.pre,v 1.450.2.4 2008/01/22 14:36:46 hno Exp $ # # SQUID Web Proxy Cache http://www.squid-cache.org/ # ---------------------------------------------------------- @@ -507,6 +507,7 @@ acl aclname port 80 70 21 ... acl aclname port 0-1024 ... # ranges allowed acl aclname myport 3128 ... # (local socket TCP port) + acl aclname myportname 3128 ... # http(s)_port name acl aclname proto HTTP FTP ... acl aclname method GET POST ... acl aclname browser [-i] regexp ... @@ -1047,6 +1048,9 @@ support is still incomplete, but should work with most clients. + 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 @@ -1162,6 +1166,9 @@ 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 Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid/squid/src/enums.h,v retrieving revision 1.245 retrieving revision 1.245.2.1 diff -u -r1.245 -r1.245.2.1 --- squid/src/enums.h 14 Dec 2007 20:05:24 -0000 1.245 +++ squid/src/enums.h 22 Jan 2008 14:36:46 -0000 1.245.2.1 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.245 2007/12/14 20:05:24 hno Exp $ + * $Id: enums.h,v 1.245.2.1 2008/01/22 14:36:46 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -114,6 +114,7 @@ ACL_URL_REGEX, ACL_URL_PORT, ACL_MY_PORT, + ACL_MY_PORT_NAME, #if USE_IDENT ACL_IDENT, ACL_IDENT_REGEX,