mirror of
https://github.com/curl/curl.git
synced 2026-07-08 23:17:16 +03:00
setopt: make CURLOPT_KEYPASSWD work for SSH-only builds
This option is used for both TLS and SSH so it needs to be handled
even in TLS-disabled builds
Mention this in the man page as well.
Follow-up to 52fa8d9
Pointed out by Codex Security
Closes #22121
This commit is contained in:
parent
372401f969
commit
0d6e5944bc
2 changed files with 13 additions and 7 deletions
|
|
@ -9,6 +9,8 @@ See-also:
|
|||
- CURLOPT_SSLKEY (3)
|
||||
Protocol:
|
||||
- TLS
|
||||
- SFTP
|
||||
- SCP
|
||||
TLS-backend:
|
||||
- OpenSSL
|
||||
- mbedTLS
|
||||
|
|
|
|||
18
lib/setopt.c
18
lib/setopt.c
|
|
@ -1884,7 +1884,8 @@ static CURLcode setopt_ech(struct Curl_easy *data, const char *ptr)
|
|||
#define setopt_ech(x,y) CURLE_NOT_BUILT_IN
|
||||
#endif
|
||||
|
||||
#ifdef USE_SSL
|
||||
#if defined(USE_SSL) || defined(USE_SSH)
|
||||
/* One of the options is used for both TLS and SSH */
|
||||
static CURLcode setopt_cptr_ssl(struct Curl_easy *data, CURLoption option,
|
||||
char *ptr)
|
||||
{
|
||||
|
|
@ -1892,6 +1893,13 @@ static CURLcode setopt_cptr_ssl(struct Curl_easy *data, CURLoption option,
|
|||
struct UserDefined *s = &data->set;
|
||||
|
||||
switch(option) {
|
||||
case CURLOPT_KEYPASSWD:
|
||||
/*
|
||||
* String that holds the SSL or SSH private key password.
|
||||
*/
|
||||
result = Curl_setstropt(&s->str[STRING_KEY_PASSWD], ptr);
|
||||
break;
|
||||
#ifdef USE_SSL
|
||||
case CURLOPT_CAINFO:
|
||||
/*
|
||||
* Set CA info for SSL connection. Specify filename of the CA certificate
|
||||
|
|
@ -1965,11 +1973,6 @@ static CURLcode setopt_cptr_ssl(struct Curl_easy *data, CURLoption option,
|
|||
* String that holds file type of the SSL key to use
|
||||
*/
|
||||
return Curl_setstropt(&s->str[STRING_KEY_TYPE], ptr);
|
||||
case CURLOPT_KEYPASSWD:
|
||||
/*
|
||||
* String that holds the SSL or SSH private key password.
|
||||
*/
|
||||
return Curl_setstropt(&s->str[STRING_KEY_PASSWD], ptr);
|
||||
case CURLOPT_SSLENGINE:
|
||||
/*
|
||||
* String that holds the SSL crypto engine.
|
||||
|
|
@ -2015,6 +2018,7 @@ static CURLcode setopt_cptr_ssl(struct Curl_easy *data, CURLoption option,
|
|||
return CURLE_NOT_BUILT_IN;
|
||||
case CURLOPT_ECH:
|
||||
return setopt_ech(data, ptr);
|
||||
#endif
|
||||
default:
|
||||
return CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
|
|
@ -2501,7 +2505,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
|
|||
#ifndef CURL_DISABLE_PROXY
|
||||
setopt_cptr_proxy,
|
||||
#endif
|
||||
#ifdef USE_SSL
|
||||
#if defined(USE_SSL) || defined(USE_SSH)
|
||||
setopt_cptr_ssl,
|
||||
#endif
|
||||
#ifdef USE_SSH
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue