]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix logic error in rev.13930
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 17 Aug 2016 13:34:13 +0000 (01:34 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 17 Aug 2016 13:34:13 +0000 (01:34 +1200)
 Using !=0 on both string compares means any login= value will permit
 40x responses through. Only PASS and PASSTHRU should be doing that.

 Detected by Coverity Scan. Issue 1364711

src/tunnel.cc

index 43e74dd54f0b61bb002a00f0dd512287d6d925e1..73d64115af494a26b2ab955593949914ab37c7a8 100644 (file)
@@ -476,7 +476,7 @@ TunnelStateData::handleConnectResponse(const size_t chunkSize)
 
     // we need to relay the 401/407 responses when login=PASS(THRU)
     const char *pwd = server.conn->getPeer()->login;
-    const bool relay = pwd && (strcmp(pwd, "PASS") != 0 || strcmp(pwd, "PASSTHRU") != 0) &&
+    const bool relay = pwd && (strcmp(pwd, "PASS") == 0 || strcmp(pwd, "PASSTHRU") == 0) &&
                        (*status_ptr == Http::scProxyAuthenticationRequired ||
                         *status_ptr == Http::scUnauthorized);