From 97c272e5d173ad5f706443e2477f0a84f0044edd Mon Sep 17 00:00:00 2001 From: Linus Nielsen Date: Sun, 29 Mar 2015 14:52:31 +0200 Subject: Negotiate: custom service names for SPNEGO. * Add new options, CURLOPT_PROXY_SERVICE_NAME and CURLOPT_SERVICE_NAME. * Add new curl options, --proxy-service-name and --service-name. --- src/tool_cfgable.c | 2 ++ src/tool_cfgable.h | 4 ++++ src/tool_getparam.c | 8 ++++++++ src/tool_operate.c | 11 +++++++++++ 4 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index c78c89613..ba6c468c5 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -136,6 +136,8 @@ static void free_config_fields(struct OperationConfig *config) Curl_safefree(config->socksproxy); Curl_safefree(config->socks5_gssapi_service); + Curl_safefree(config->proxy_service_name); + Curl_safefree(config->service_name); Curl_safefree(config->ftp_account); Curl_safefree(config->ftp_alternative_to_user); diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h index d1f223871..048eb4ffe 100644 --- a/src/tool_cfgable.h +++ b/src/tool_cfgable.h @@ -166,8 +166,12 @@ struct OperationConfig { int socksver; /* set to CURLPROXY_SOCKS* define */ char *socks5_gssapi_service; /* set service name for gssapi principal * default rcmd */ + char *proxy_service_name; /* set service name for proxy negotiation + * default HTTP */ int socks5_gssapi_nec ; /* The NEC reference server does not protect * the encryption type exchange */ + char *service_name; /* set negotiation service name + * default HTTP */ bool tcp_nodelay; long req_retry; /* number of retries */ diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 1b5d6d2b0..62283a5dd 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -161,6 +161,8 @@ static const struct LongShort aliases[]= { #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) {"$6", "socks5-gssapi-service", TRUE}, {"$7", "socks5-gssapi-nec", FALSE}, + {"$O", "proxy-service-name", TRUE}, + {"$P", "service-name", TRUE}, #endif {"$8", "proxy1.0", TRUE}, {"$9", "tftp-blksize", TRUE}, @@ -903,6 +905,12 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ case '7': /* --socks5-gssapi-nec*/ config->socks5_gssapi_nec = toggle; break; + case 'O': /* --proxy-service-name */ + GetStr(&config->proxy_service_name, nextarg); + break; + case 'P': /* --service-name */ + GetStr(&config->service_name, nextarg); + break; #endif case '8': /* --proxy1.0 */ /* http 1.0 proxy */ diff --git a/src/tool_operate.c b/src/tool_operate.c index 74e4002b1..5f7b79211 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1217,6 +1217,17 @@ static CURLcode operate_do(struct GlobalConfig *global, if(config->socks5_gssapi_nec) my_setopt_str(curl, CURLOPT_SOCKS5_GSSAPI_NEC, config->socks5_gssapi_nec); + + /* new in curl 7.43.0 */ + if(config->proxy_service_name) + my_setopt_str(curl, CURLOPT_PROXY_SERVICE_NAME, + config->proxy_service_name); + + /* new in curl 7.43.0 */ + if(config->service_name) + my_setopt_str(curl, CURLOPT_SERVICE_NAME, + config->service_name); + } #endif /* curl 7.13.0 */ -- cgit v1.2.3