Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/libcurl/opts/CURLOPT_KEYPASSWD.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ See-also:
- CURLOPT_SSLKEY (3)
Protocol:
- TLS
- SFTP
- SCP
TLS-backend:
- OpenSSL
- mbedTLS
Expand Down
18 changes: 11 additions & 7 deletions lib/setopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1884,14 +1884,22 @@ 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)
{
CURLcode result = CURLE_OK;
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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
Loading