urldata: cease storing TLS auth type

The only TLS auth type libcurl ever supported is SRP and that is the
default type. Since nobody ever sets any other type, there is no point
in wasting space to store the set type and code to check the type.

If TLS auth is used, SRP is now implied.

Closes #10181
This commit is contained in:
Daniel Stenberg 2022-12-30 15:04:57 +01:00
parent df856cb5c9
commit becfe2ec78
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 12 additions and 48 deletions

View file

@ -2843,52 +2843,33 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
case CURLOPT_TLSAUTH_USERNAME:
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME],
va_arg(param, char *));
if(data->set.str[STRING_TLSAUTH_USERNAME] &&
!data->set.ssl.primary.authtype)
data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
break;
#ifndef CURL_DISABLE_PROXY
case CURLOPT_PROXY_TLSAUTH_USERNAME:
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_PROXY],
va_arg(param, char *));
if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] &&
!data->set.proxy_ssl.primary.authtype)
data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to
SRP */
break;
#endif
case CURLOPT_TLSAUTH_PASSWORD:
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD],
va_arg(param, char *));
if(data->set.str[STRING_TLSAUTH_USERNAME] &&
!data->set.ssl.primary.authtype)
data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default */
break;
#ifndef CURL_DISABLE_PROXY
case CURLOPT_PROXY_TLSAUTH_PASSWORD:
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_PROXY],
va_arg(param, char *));
if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] &&
!data->set.proxy_ssl.primary.authtype)
data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default */
break;
#endif
case CURLOPT_TLSAUTH_TYPE:
argptr = va_arg(param, char *);
if(!argptr ||
strncasecompare(argptr, "SRP", strlen("SRP")))
data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP;
else
data->set.ssl.primary.authtype = CURL_TLSAUTH_NONE;
if(argptr && !strncasecompare(argptr, "SRP", strlen("SRP")))
return CURLE_BAD_FUNCTION_ARGUMENT;
break;
#ifndef CURL_DISABLE_PROXY
case CURLOPT_PROXY_TLSAUTH_TYPE:
argptr = va_arg(param, char *);
if(!argptr ||
strncasecompare(argptr, "SRP", strlen("SRP")))
data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP;
else
data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_NONE;
if(argptr || !strncasecompare(argptr, "SRP", strlen("SRP")))
return CURLE_BAD_FUNCTION_ARGUMENT;
break;
#endif
#endif