From: hno <> Date: Fri, 21 Dec 2001 16:47:33 +0000 (+0000) Subject: referer_regex ACL type by "Brian" X-Git-Tag: SQUID_3_0_PRE1~1242 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc659d9d116af55a190343bcc1f5f0548a7af9e9;p=thirdparty%2Fsquid.git referer_regex ACL type by "Brian" --- diff --git a/CONTRIBUTORS b/CONTRIBUTORS index cde86a4720..bf5e3e91c9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -84,5 +84,6 @@ and ideas to make this software available. Moez Mahfoudh Guido Serassio Miquel van Smoorenburg + Brian Duane Wessels diff --git a/src/acl.cc b/src/acl.cc index 22aaa3b58c..03f6d844f5 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.269 2001/11/13 18:50:43 hno Exp $ + * $Id: acl.cc,v 1.270 2001/12/21 09:47:34 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -198,6 +198,8 @@ aclStrToType(const char *s) return ACL_METHOD; if (!strcmp(s, "browser")) return ACL_BROWSER; + if (!strcmp(s, "referer_regex")) + return ACL_REFERER_REGEX; if (!strcmp(s, "proxy_auth")) return ACL_PROXY_AUTH; if (!strcmp(s, "proxy_auth_regex")) @@ -268,6 +270,8 @@ aclTypeToStr(squid_acl type) return "method"; if (type == ACL_BROWSER) return "browser"; + if (type == ACL_REFERER_REGEX) + return "referer_regex"; if (type == ACL_PROXY_AUTH) return "proxy_auth"; if (type == ACL_PROXY_AUTH_REGEX) @@ -781,6 +785,7 @@ aclParseAclLine(acl ** head) case ACL_URL_REGEX: case ACL_URLPATH_REGEX: case ACL_BROWSER: + case ACL_REFERER_REGEX: case ACL_SRC_DOM_REGEX: case ACL_DST_DOM_REGEX: case ACL_REQ_MIME_TYPE: @@ -1425,6 +1430,7 @@ aclMatchAcl(acl * ae, aclCheck_t * checklist) return 0; switch (ae->type) { case ACL_BROWSER: + case ACL_REFERER_REGEX: case ACL_DST_ASN: case ACL_DST_DOMAIN: case ACL_DST_DOM_REGEX: @@ -1583,6 +1589,12 @@ aclMatchAcl(acl * ae, aclCheck_t * checklist) return 0; return aclMatchRegex(ae->data, browser); /* NOTREACHED */ + case ACL_REFERER_REGEX: + header = httpHeaderGetStr(&checklist->request->header, HDR_REFERER); + if (NULL == header) + return 0; + return aclMatchRegex(ae->data, header); + /* NOTREACHED */ case ACL_PROXY_AUTH: case ACL_PROXY_AUTH_REGEX: case ACL_MAX_USER_IP: @@ -2081,6 +2093,7 @@ aclDestroyAcls(acl ** head) case ACL_URL_REGEX: case ACL_URLPATH_REGEX: case ACL_BROWSER: + case ACL_REFERER_REGEX: case ACL_SRC_DOM_REGEX: case ACL_DST_DOM_REGEX: case ACL_REP_MIME_TYPE: @@ -2427,6 +2440,7 @@ aclDumpGeneric(const acl * a) case ACL_URL_REGEX: case ACL_URLPATH_REGEX: case ACL_BROWSER: + case ACL_REFERER_REGEX: case ACL_SRC_DOM_REGEX: case ACL_DST_DOM_REGEX: case ACL_REQ_MIME_TYPE: diff --git a/src/cf.data.pre b/src/cf.data.pre index b8984760d1..924b43b648 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.244 2001/12/11 02:35:54 hno Exp $ +# $Id: cf.data.pre,v 1.245 2001/12/21 09:47:34 hno Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1823,8 +1823,7 @@ DOC_START when using "file", the file should contain one item per line - acltype is one of src dst srcdomain dstdomain url_pattern - urlpath_pattern time port proto method browser user + acltype is one of the types described below By default, regular expressions are CASE-SENSITIVE. To make them case-insensitive, use the -i option. @@ -1859,8 +1858,11 @@ DOC_START acl aclname myport 3128 ... # (local socket TCP port) acl aclname proto HTTP FTP ... acl aclname method GET POST ... - acl aclname browser [-i] regexp + acl aclname browser [-i] regexp ... # pattern match on User-Agent header + acl aclname referer_regex [-i] regexp ... + # pattern match on Referer header + # Referer is highly unreliable, so use with care acl aclname ident username ... acl aclname ident_regex [-i] pattern ... # string match on ident output. diff --git a/src/enums.h b/src/enums.h index bbf8f75227..97734ce3a0 100644 --- a/src/enums.h +++ b/src/enums.h @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.202 2001/11/28 08:01:46 robertc Exp $ + * $Id: enums.h,v 1.203 2001/12/21 09:47:34 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -116,6 +116,7 @@ typedef enum { ACL_PROTO, ACL_METHOD, ACL_BROWSER, + ACL_REFERER_REGEX, ACL_PROXY_AUTH, ACL_PROXY_AUTH_REGEX, ACL_SRC_ASN,