summaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2017-04-27 15:18:49 +0200
committerKamil Dudka <kdudka@redhat.com>2017-06-28 08:02:58 +0200
commit8924f58c370afa756fc4fd13916dfdea91d21b21 (patch)
tree3a4787e4a02182513e80e356b3a6ce79cb876496 /lib/url.c
parentcd1c9f08078d4a8566ed10f6df9ae9a729f3290b (diff)
downloadcurl-8924f58c370afa756fc4fd13916dfdea91d21b21.tar.gz
CURLOPT_SOCKS5_AUTH: allowed methods for SOCKS5 proxy auth
If libcurl was built with GSS-API support, it unconditionally advertised GSS-API authentication while connecting to a SOCKS5 proxy. This caused problems in environments with improperly configured Kerberos: a stock libcurl failed to connect, despite libcurl built without GSS-API connected fine using username and password. This commit introduces the CURLOPT_SOCKS5_AUTH option to control the allowed methods for SOCKS5 authentication at run time. Note that a new option was preferred over reusing CURLOPT_PROXYAUTH for compatibility reasons because the set of authentication methods allowed by default was different for HTTP and SOCKS5 proxies. Bug: https://curl.haxx.se/mail/lib-2017-01/0005.html Closes https://github.com/curl/curl/pull/1454
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 3b3143ab8..07bdea129 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -545,6 +545,9 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
set->httpauth = CURLAUTH_BASIC; /* defaults to basic */
set->proxyauth = CURLAUTH_BASIC; /* defaults to basic */
+ /* SOCKS5 proxy auth defaults to username/password + GSS-API */
+ set->socks5auth = CURLAUTH_BASIC | CURLAUTH_GSSAPI;
+
/* make libcurl quiet by default: */
set->hide_progress = TRUE; /* CURLOPT_NOPROGRESS changes these */
@@ -1541,6 +1544,11 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
break;
#endif /* CURL_DISABLE_PROXY */
+ case CURLOPT_SOCKS5_AUTH:
+ data->set.socks5auth = va_arg(param, unsigned long);
+ if(data->set.socks5auth & ~(CURLAUTH_BASIC | CURLAUTH_GSSAPI))
+ result = CURLE_NOT_BUILT_IN;
+ break;
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
case CURLOPT_SOCKS5_GSSAPI_NEC:
/*