]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
NTLM: ignore CURLOPT_FORBID_REUSE during NTLM HTTP auth
authorFrank Meier <frank.meier@ergon.ch>
Fri, 22 Aug 2014 12:54:41 +0000 (14:54 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 22 Aug 2014 14:05:31 +0000 (16:05 +0200)
Problem: if CURLOPT_FORBID_REUSE is set, requests using NTLM failed
since NTLM requires multiple requests that re-use the same connection
for the authentication to work

Solution: Ignore the forbid reuse flag in case the NTLM authentication
handshake is in progress, according to the NTLM state flag.

Fixed known bug #77.

docs/KNOWN_BUGS
lib/url.c

index 409a177037d7c1b37e25ab514747a1b0acb80954..a21fb194d3db547d790bd48a151eed31a1906aea 100644 (file)
@@ -51,10 +51,6 @@ may have been fixed since this was written!
   any file at all. Like when using FTP.
   http://curl.haxx.se/bug/view.cgi?id=1063
 
-77. CURLOPT_FORBID_REUSE on a handle prevents NTLM from working since it
-  "abuses" the underlying connection re-use system and if connections are
-  forced to close they break the NTLM support.
-
 76. The SOCKET type in Win64 is 64 bits large (and thus so is curl_socket_t on
   that platform), and long is only 32 bits. It makes it impossible for
   curl_easy_getinfo() to return a socket properly with the CURLINFO_LASTSOCKET
index e43b19d7560229437424a272763ba6dab04eca1e..f2ce4ffbab30d230b7b765a748516e52ce7d2397 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -5859,7 +5859,8 @@ CURLcode Curl_done(struct connectdata **connp,
   }
 
   /* if data->set.reuse_forbid is TRUE, it means the libcurl client has
-     forced us to close this no matter what we think.
+     forced us to close this connection. This is ignored for requests taking
+     place in a NTLM authentication handshake
 
      if conn->bits.close is TRUE, it means that the connection should be
      closed in spite of all our efforts to be nice, due to protocol
@@ -5871,7 +5872,10 @@ CURLcode Curl_done(struct connectdata **connp,
      we can add code that keep track of if we really must close it here or not,
      but currently we have no such detail knowledge.
   */
-  if(data->set.reuse_forbid || conn->bits.close || premature) {
+
+  if((data->set.reuse_forbid && !(conn->ntlm.state == NTLMSTATE_TYPE2 ||
+                                  conn->proxyntlm.state == NTLMSTATE_TYPE2))
+     || conn->bits.close || premature) {
     CURLcode res2 = Curl_disconnect(conn, premature); /* close connection */
 
     /* If we had an error already, make sure we return that one. But