From 7f78117a56cf9ce59403ee2212be67990187e27f Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 23 Oct 2010 07:52:09 -0600 Subject: [PATCH] Bug 3036: adaptation_access acls cannot see myportname Temporary fix to pass myportname to adaptation_access ACLs. --- src/HttpRequest.cc | 4 ++++ src/HttpRequest.h | 2 ++ src/acl/MyPortName.cc | 10 +++++----- src/client_side.cc | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 58bbe95bc6..2c1f038564 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -99,6 +99,7 @@ HttpRequest::init() peer_login = NULL; // not allocated/deallocated by this class peer_domain = NULL; // not allocated/deallocated by this class vary_headers = NULL; + myportname = null_string; tag = null_string; extacl_user = null_string; extacl_passwd = null_string; @@ -146,6 +147,8 @@ HttpRequest::clean() if (pinned_connection) cbdataReferenceDone(pinned_connection); + myportname.clean(); + tag.clean(); extacl_user.clean(); @@ -205,6 +208,7 @@ HttpRequest::clone() const copy->vary_headers = vary_headers ? xstrdup(vary_headers) : NULL; // XXX: what to do with copy->peer_domain? + copy->myportname = myportname; copy->tag = tag; copy->extacl_user = extacl_user; copy->extacl_passwd = extacl_passwd; diff --git a/src/HttpRequest.h b/src/HttpRequest.h index 119d63c052..f2834b61eb 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -187,6 +187,8 @@ public: char *peer_domain; /* Configured peer forceddomain */ + String myportname; // Internal tag name= value from port this requests arrived in. + String tag; /* Internal tag for this request */ String extacl_user; /* User name returned by extacl lookup */ diff --git a/src/acl/MyPortName.cc b/src/acl/MyPortName.cc index c95e2ac5ba..75d384473a 100644 --- a/src/acl/MyPortName.cc +++ b/src/acl/MyPortName.cc @@ -38,18 +38,18 @@ #include "acl/MyPortName.h" #include "acl/StringData.h" #include "acl/Checklist.h" +#include "HttpRequest.h" /* for ConnStateData */ #include "client_side.h" - - - int -ACLMyPortNameStrategy::match (ACLData * &data, ACLFilledChecklist *checklist) +ACLMyPortNameStrategy::match(ACLData * &data, ACLFilledChecklist *checklist) { if (checklist->conn() != NULL) - return data->match (checklist->conn()->port->name); + return data->match(checklist->conn()->port->name); + if (checklist->request != NULL) + return data->match(checklist->request->myportname.termedBuf()); return 0; } diff --git a/src/client_side.cc b/src/client_side.cc index e0864e490a..8a0f996581 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -2411,6 +2411,7 @@ clientProcessRequest(ConnStateData *conn, HttpParser *hp, ClientSocketContext *c request->indirect_client_addr = conn->peer; #endif /* FOLLOW_X_FORWARDED_FOR */ request->my_addr = conn->me; + request->myportname = conn->port->name; request->http_ver = http_ver; tePresent = request->header.has(HDR_TRANSFER_ENCODING); -- 2.47.2