aboutsummaryrefslogtreecommitdiff
path: root/lib/http_negotiate.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-08-16 22:19:38 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-08-16 22:26:52 +0200
commit13b8fc46a3fd6b202a7f2df5f9aff4f26fe6c4db (patch)
tree1dddad218ea07f0eb78a1dedd47876f420612970 /lib/http_negotiate.c
parent9f4a174698974829cea2dde1fcd598ab6d401b0d (diff)
negotiation: Wrong proxy authorization
There's an error in http_negotiation.c where a mistake is using only userpwd even for proxy requests. Ludek provided a patch, but I decided to write the fix slightly different using his patch as inspiration. Reported by: Ludek Finstrle Bug: http://curl.haxx.se/bug/view.cgi?id=3046066
Diffstat (limited to 'lib/http_negotiate.c')
-rw-r--r--lib/http_negotiate.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index ab1296e5b..80b0b507d 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -277,6 +277,7 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
&conn->data->state.negotiate;
char *encoded = NULL;
size_t len;
+ char *userp;
#ifdef HAVE_SPNEGO /* Handle SPNEGO */
if(checkprefix("Negotiate", neg_ctx->protocol)) {
@@ -330,12 +331,16 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
if(len == 0)
return CURLE_OUT_OF_MEMORY;
- conn->allocptr.userpwd =
- aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "",
- neg_ctx->protocol, encoded);
+ userp = aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "",
+ neg_ctx->protocol, encoded);
+
+ if(proxy)
+ conn->allocptr.proxyuserpwd = userp;
+ else
+ conn->allocptr.userpwd = userp;
free(encoded);
Curl_cleanup_negotiate (conn->data);
- return (conn->allocptr.userpwd == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;
+ return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;
}
static void cleanup(struct negotiatedata *neg_ctx)