From: Alexander Gozman Date: Wed, 24 Oct 2018 15:28:13 +0000 (+0000) Subject: Fix client_connection_mark handling of clientless transactions (#312) X-Git-Tag: SQUID_4_5~7 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=d4c76c25a9281a2b55bd868c38239a07e5301166;p=thirdparty%2Fsquid.git Fix client_connection_mark handling of clientless transactions (#312) Also affects the deprecated clientside_mark ACL. Broken since CONNMARK matching was added in commit 653d992. --- diff --git a/src/acl/ConnMark.cc b/src/acl/ConnMark.cc index 5a62e6f36a..d5b0b3449b 100644 --- a/src/acl/ConnMark.cc +++ b/src/acl/ConnMark.cc @@ -74,15 +74,22 @@ int Acl::ConnMark::match(ACLChecklist *cl) { const auto *checklist = Filled(cl); - const auto connmark = checklist->conn()->clientConnection->nfmark; + const auto conn = checklist->conn(); - for (const auto &m : marks) { - if ((connmark & m.second) == m.first) { - debugs(28, 5, "found " << m << " matching " << asHex(connmark)); - return 1; + if (conn && conn->clientConnection) { + const auto connmark = conn->clientConnection->nfmark; + + for (const auto &m : marks) { + if ((connmark & m.second) == m.first) { + debugs(28, 5, "found " << m << " matching " << asHex(connmark)); + return 1; + } + debugs(28, 7, "skipped " << m << " mismatching " << asHex(connmark)); } - debugs(28, 7, "skipped " << m << " mismatching " << asHex(connmark)); + } else { + debugs(28, 7, "fails: no client connection"); } + return 0; }