tool_getparam: fail --hostpubsha256 if libssh2 is not used

Reported-by: Harry Sintonen
Closes #16109
This commit is contained in:
Daniel Stenberg 2025-01-28 09:20:35 +01:00
parent 1b740aedcd
commit 58c22dda66
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 8 additions and 1 deletions

View File

@ -2406,7 +2406,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
}
break;
case C_HOSTPUBSHA256: /* --hostpubsha256 */
err = getstr(&config->hostpubsha256, nextarg, DENY_BLANK);
if(!feature_libssh2)
err = PARAM_LIBCURL_DOESNT_SUPPORT;
else
err = getstr(&config->hostpubsha256, nextarg, DENY_BLANK);
break;
case C_CRLFILE: /* --crlfile */
err = getstr(&config->crlfile, nextarg, DENY_BLANK);

View File

@ -77,6 +77,7 @@ bool feature_http2 = FALSE;
bool feature_http3 = FALSE;
bool feature_httpsproxy = FALSE;
bool feature_libz = FALSE;
bool feature_libssh2 = FALSE;
bool feature_ntlm = FALSE;
bool feature_ntlm_wb = FALSE;
bool feature_spnego = FALSE;
@ -190,6 +191,8 @@ CURLcode get_libcurl_info(void)
++feature_count;
}
feature_libssh2 = curlinfo->libssh_version &&
!strncmp("libssh2", curlinfo->libssh_version, 7);
return CURLE_OK;
}

View File

@ -55,6 +55,7 @@ extern bool feature_http2;
extern bool feature_http3;
extern bool feature_httpsproxy;
extern bool feature_libz;
extern bool feature_libssh2;
extern bool feature_ntlm;
extern bool feature_ntlm_wb;
extern bool feature_spnego;