From: Amos Jeffries Date: Tue, 19 Oct 2010 02:37:51 +0000 (-0600) Subject: Bug 3036: adaptation_access acls cannot see myportname X-Git-Tag: take1~165 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=35fb56c90ac928e08c61f43a228ef70e014f6f0e;p=thirdparty%2Fsquid.git Bug 3036: adaptation_access acls cannot see myportname Temporary fix to pass myportname to adaptation_access ACLs. --- diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index b383791a6d..b8274800a9 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -104,6 +104,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; @@ -152,6 +153,8 @@ HttpRequest::clean() if (pinned_connection) cbdataReferenceDone(pinned_connection); + myportname.clean(); + tag.clean(); extacl_user.clean(); @@ -211,6 +214,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 447bb22017..b632829336 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -205,6 +205,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 3fecaf7643..52b6090313 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -2476,6 +2476,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; if (request->header.chunked()) {