]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3036: adaptation_access acls cannot see myportname
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 23 Oct 2010 13:52:09 +0000 (07:52 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sat, 23 Oct 2010 13:52:09 +0000 (07:52 -0600)
Temporary fix to pass myportname to adaptation_access ACLs.

src/HttpRequest.cc
src/HttpRequest.h
src/acl/MyPortName.cc
src/client_side.cc

index 58bbe95bc6a9dc764511f68e5a99491837f52bf1..2c1f038564028160818bd7f7938eda971a6f8ae1 100644 (file)
@@ -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;
index 119d63c0521d3eb7a4aef8c1fafcee41744ed8fc..f2834b61eb3462dc6b71cbfea1be1a5160807606 100644 (file)
@@ -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 */
index c95e2ac5babe86928a29ddcfe27bc7671e071d73..75d384473a89b6d819f78711b89205cb102a2d38 100644 (file)
 #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<MatchType> * &data, ACLFilledChecklist *checklist)
+ACLMyPortNameStrategy::match(ACLData<MatchType> * &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;
 }
 
index e0864e490a109d9dd06feae935e4fd63a1dbed69..8a0f9965810388115d71782ece214405fbdd9866 100644 (file)
@@ -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);