]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3655: pinning failure breaks NTLM and Negotiate authentication
authorWolfgang Breyha <wbreyha@gmx.net>
Thu, 18 Oct 2012 04:23:10 +0000 (22:23 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 18 Oct 2012 04:23:10 +0000 (22:23 -0600)
Some additional bits for squid-3.2 ensuring that already pinned connections
are cleaned up properly before re-pinning. Also that the pointer is not
NULL before closing when un-pinning.

src/client_side.cc

index 9f375368a6ed796f760637c8e3d14bc7b692b918..5ef4157701cd48b8c0a30cf8575877781195a1ff 100644 (file)
@@ -4034,11 +4034,8 @@ ConnStateData::pinConnection(const Comm::ConnectionPointer &pinServer, HttpReque
     if (Comm::IsConnOpen(pinning.serverConnection)) {
         if (pinning.serverConnection->fd == pinServer->fd)
             return;
-
-        unpinConnection(); // clears fields ready for re-use. Prevent close() scheduling our close handler.
-        pinning.serverConnection->close();
-    } else
-        unpinConnection(); // clears fields ready for re-use.
+    }
+    unpinConnection(); // clears fields ready for re-use. Prevent close() scheduling our close handler.
 
     pinning.serverConnection = pinServer;
     pinning.host = xstrdup(request->GetHost());
@@ -4096,7 +4093,8 @@ ConnStateData::unpinConnection()
         pinning.closeHandler = NULL;
     }
     /// also close the server side socket, we should not use it for any future requests...
-    pinning.serverConnection->close();
+    if (Comm::IsConnOpen(pinning.serverConnection))
+        pinning.serverConnection->close();
     safe_free(pinning.host);
 
     /* NOTE: pinning.pinned should be kept. This combined with fd == -1 at the end of a request indicates that the host