|
|
92baa4 |
From 2ac0f436a3ed216d3fc634592d302c6b8efe25d0 Mon Sep 17 00:00:00 2001
|
|
|
92baa4 |
From: Frank Meier <frank.meier@ergon.ch>
|
|
|
92baa4 |
Date: Fri, 22 Aug 2014 14:54:41 +0200
|
|
|
92baa4 |
Subject: [PATCH] NTLM: ignore CURLOPT_FORBID_REUSE during NTLM HTTP auth
|
|
|
92baa4 |
|
|
|
92baa4 |
Problem: if CURLOPT_FORBID_REUSE is set, requests using NTLM failed
|
|
|
92baa4 |
since NTLM requires multiple requests that re-use the same connection
|
|
|
92baa4 |
for the authentication to work
|
|
|
92baa4 |
|
|
|
92baa4 |
Solution: Ignore the forbid reuse flag in case the NTLM authentication
|
|
|
92baa4 |
handshake is in progress, according to the NTLM state flag.
|
|
|
92baa4 |
|
|
|
92baa4 |
Fixed known bug #77.
|
|
|
92baa4 |
|
|
|
92baa4 |
Upstream-commit: 63a0bd4270decef04e64fbe497b42f2c9e26c62b
|
|
|
92baa4 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
92baa4 |
---
|
|
|
92baa4 |
docs/KNOWN_BUGS | 4 ----
|
|
|
92baa4 |
lib/url.c | 7 +++++--
|
|
|
92baa4 |
2 files changed, 5 insertions(+), 6 deletions(-)
|
|
|
92baa4 |
|
|
|
92baa4 |
diff --git a/docs/KNOWN_BUGS b/docs/KNOWN_BUGS
|
|
|
92baa4 |
index d363827..170987e 100644
|
|
|
92baa4 |
--- a/docs/KNOWN_BUGS
|
|
|
92baa4 |
+++ b/docs/KNOWN_BUGS
|
|
|
92baa4 |
@@ -18,10 +18,6 @@ may have been fixed since this was written!
|
|
|
92baa4 |
any file at all. Like when using FTP.
|
|
|
92baa4 |
http://curl.haxx.se/bug/view.cgi?id=3438362
|
|
|
92baa4 |
|
|
|
92baa4 |
-77. CURLOPT_FORBID_REUSE on a handle prevents NTLM from working since it
|
|
|
92baa4 |
- "abuses" the underlying connection re-use system and if connections are
|
|
|
92baa4 |
- forced to close they break the NTLM support.
|
|
|
92baa4 |
-
|
|
|
92baa4 |
76. The SOCKET type in Win64 is 64 bits large (and thus so is curl_socket_t on
|
|
|
92baa4 |
that platform), and long is only 32 bits. It makes it impossible for
|
|
|
92baa4 |
curl_easy_getinfo() to return a socket properly with the CURLINFO_LASTSOCKET
|
|
|
92baa4 |
diff --git a/lib/url.c b/lib/url.c
|
|
|
92baa4 |
index de8e153..5fcef89 100644
|
|
|
92baa4 |
--- a/lib/url.c
|
|
|
92baa4 |
+++ b/lib/url.c
|
|
|
92baa4 |
@@ -5252,7 +5252,8 @@ CURLcode Curl_done(struct connectdata **connp,
|
|
|
92baa4 |
}
|
|
|
92baa4 |
|
|
|
92baa4 |
/* if data->set.reuse_forbid is TRUE, it means the libcurl client has
|
|
|
92baa4 |
- forced us to close this no matter what we think.
|
|
|
92baa4 |
+ forced us to close this connection. This is ignored for requests taking
|
|
|
92baa4 |
+ place in a NTLM authentication handshake
|
|
|
92baa4 |
|
|
|
92baa4 |
if conn->bits.close is TRUE, it means that the connection should be
|
|
|
92baa4 |
closed in spite of all our efforts to be nice, due to protocol
|
|
|
92baa4 |
@@ -5267,7 +5268,9 @@ CURLcode Curl_done(struct connectdata **connp,
|
|
|
92baa4 |
connection_id == -1 here means that the connection has not been added
|
|
|
92baa4 |
to the connection cache (OOM) and thus we must disconnect it here.
|
|
|
92baa4 |
*/
|
|
|
92baa4 |
- if(data->set.reuse_forbid || conn->bits.close || premature ||
|
|
|
92baa4 |
+ if((data->set.reuse_forbid && !(conn->ntlm.state == NTLMSTATE_TYPE2 ||
|
|
|
92baa4 |
+ conn->proxyntlm.state == NTLMSTATE_TYPE2))
|
|
|
92baa4 |
+ || conn->bits.close || premature ||
|
|
|
92baa4 |
(-1 == conn->connection_id)) {
|
|
|
92baa4 |
CURLcode res2 = Curl_disconnect(conn, premature); /* close connection */
|
|
|
92baa4 |
|
|
|
92baa4 |
--
|
|
|
92baa4 |
2.1.0
|
|
|
92baa4 |
|