mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 12:05:06 -05:00
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
This commit is contained in:
parent
9f4a174698
commit
13b8fc46a3
@ -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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* 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;
|
&conn->data->state.negotiate;
|
||||||
char *encoded = NULL;
|
char *encoded = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
char *userp;
|
||||||
|
|
||||||
#ifdef HAVE_SPNEGO /* Handle SPNEGO */
|
#ifdef HAVE_SPNEGO /* Handle SPNEGO */
|
||||||
if(checkprefix("Negotiate", neg_ctx->protocol)) {
|
if(checkprefix("Negotiate", neg_ctx->protocol)) {
|
||||||
@ -330,12 +331,16 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
|
|||||||
if(len == 0)
|
if(len == 0)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
conn->allocptr.userpwd =
|
userp = aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "",
|
||||||
aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "",
|
|
||||||
neg_ctx->protocol, encoded);
|
neg_ctx->protocol, encoded);
|
||||||
|
|
||||||
|
if(proxy)
|
||||||
|
conn->allocptr.proxyuserpwd = userp;
|
||||||
|
else
|
||||||
|
conn->allocptr.userpwd = userp;
|
||||||
free(encoded);
|
free(encoded);
|
||||||
Curl_cleanup_negotiate (conn->data);
|
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)
|
static void cleanup(struct negotiatedata *neg_ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user