/*
- * $Id: acl.cc,v 1.213 2000/05/01 05:11:55 wessels Exp $
+ * $Id: acl.cc,v 1.214 2000/05/02 19:58:13 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#if USE_IDENT
if (!strcmp(s, "ident"))
return ACL_IDENT;
+ if (!strcmp(s, "ident_regex"))
+ return ACL_IDENT_REGEX;
#endif
if (!strncmp(s, "proto", 5))
return ACL_PROTO;
return ACL_BROWSER;
if (!strcmp(s, "proxy_auth"))
return ACL_PROXY_AUTH;
+ if (!strcmp(s, "proxy_auth_regex"))
+ return ACL_PROXY_AUTH_REGEX;
if (!strcmp(s, "src_as"))
return ACL_SRC_ASN;
if (!strcmp(s, "dst_as"))
#if USE_IDENT
if (type == ACL_IDENT)
return "ident";
+ if (type == ACL_IDENT_REGEX)
+ return "ident_regex";
#endif
if (type == ACL_PROTO)
return "proto";
return "browser";
if (type == ACL_PROXY_AUTH)
return "proxy_auth";
+ if (type == ACL_PROXY_AUTH_REGEX)
+ return "proxy_auth_regex";
if (type == ACL_SRC_ASN)
return "src_as";
if (type == ACL_DST_ASN)
case ACL_IDENT:
aclParseWordList(&A->data);
break;
+ case ACL_IDENT_REGEX:
+ aclParseRegexList(&A->data);
+ break;
#endif
case ACL_PROTO:
aclParseProtoList(&A->data);
assert(proxy_auth_cache);
}
break;
+ case ACL_PROXY_AUTH_REGEX:
+ aclParseRegexList(&A->data);
+ if (!proxy_auth_cache) {
+ /* First time around, 7921 should be big enough */
+ proxy_auth_cache = hash_create((HASHCMP *) strcmp, 7921, hash_string);
+ assert(proxy_auth_cache);
+ }
+ break;
#if SQUID_SNMP
case ACL_SNMP_COMMUNITY:
aclParseWordList(&A->data);
*/
static int
-aclMatchProxyAuth(wordlist * data, const char *proxy_auth, acl_proxy_auth_user * auth_user, aclCheck_t * checklist)
+aclMatchProxyAuth(void * data, const char *proxy_auth, acl_proxy_auth_user * auth_user, aclCheck_t * checklist, squid_acl acltype)
{
/* checklist is used to register user name when identified, nothing else */
LOCAL_ARRAY(char, login_buf, USER_IDENT_SZ);
auth_user->ipaddr = checklist->src_addr;
/* copy username to request for logging on client-side */
xstrncpy(checklist->request->user_ident, user, USER_IDENT_SZ);
- return aclMatchUser(data, user);
+ switch(acltype) {
+ case ACL_PROXY_AUTH:
+ return aclMatchUser(data, user);
+ case ACL_PROXY_AUTH_REGEX:
+ return aclMatchRegex(data, user);
+ default:
+ fatal("aclMatchProxyAuth: unknown ACL type");
+ return 0; /* NOTREACHED */
+ }
} else {
/* user has switched to another IP addr */
debug(28, 1) ("aclMatchProxyAuth: user '%s' has changed IP address\n", user);
return 0;
}
/* NOTREACHED */
+ case ACL_IDENT_REGEX:
+ if (checklist->ident[0]) {
+ return aclMatchRegex(ae->data, checklist->ident);
+ } else {
+ checklist->state[ACL_IDENT] = ACL_LOOKUP_NEEDED;
+ return 0;
+ }
+ /* NOTREACHED */
#endif
case ACL_PROTO:
return aclMatchInteger(ae->data, r->protocol);
return aclMatchRegex(ae->data, browser);
/* NOTREACHED */
case ACL_PROXY_AUTH:
+ case ACL_PROXY_AUTH_REGEX:
if (NULL == r) {
return -1;
} else if (!r->flags.accelerated) {
switch (aclMatchProxyAuth(ae->data,
header,
checklist->auth_user,
- checklist)) {
+ checklist,
+ ae->type)) {
case 0:
/* Correct password, but was not allowed in this ACL */
return 0;
case ACL_TIME:
aclDestroyTimeList(a->data);
break;
+#if USE_IDENT
+ case ACL_IDENT_REGEX:
+#endif
+ case ACL_PROXY_AUTH_REGEX:
case ACL_URL_REGEX:
case ACL_URLPATH_REGEX:
case ACL_BROWSER:
#endif
#if USE_IDENT
case ACL_IDENT:
+ return wordlistDup(a->data);
+ break;
+ case ACL_IDENT_REGEX:
+ return aclDumpRegexList(a->data);
+ break;
#endif
case ACL_PROXY_AUTH:
return wordlistDup(a->data);
case ACL_TIME:
return aclDumpTimeSpecList(a->data);
break;
+ case ACL_PROXY_AUTH_REGEX:
case ACL_URL_REGEX:
case ACL_URLPATH_REGEX:
case ACL_BROWSER:
#
-# $Id: cf.data.pre,v 1.172 2000/05/02 19:43:30 hno Exp $
+# $Id: cf.data.pre,v 1.173 2000/05/02 19:58:13 hno Exp $
#
#
# SQUID Internet Object Cache http://squid.nlanr.net/Squid/
acl aclname browser [-i] regexp
# pattern match on User-Agent header
acl aclname ident username ...
+ acl aclname ident_regex [-i] pattern ...
# string match on ident output.
# use REQUIRED to accept any non-null ident.
acl aclname src_as number ...
# cache_peer_access mycache_mydomain.net deny all
acl aclname proxy_auth username ...
+ acl aclname proxy_auth_regex [-i] pattern ...
# list of valid usernames
# use REQUIRED to accept any valid username.
#