]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix logic error in rev.14321
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 9 Aug 2016 14:08:25 +0000 (02:08 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 9 Aug 2016 14:08:25 +0000 (02:08 +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 de62c732a0dd5af67d1b4a3683e0759f7782d91c..0a76aaa452e9516bbd8283a4e996d570345383e7 100644 (file)
@@ -499,7 +499,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);