From 58c22dda66926293821cda0ac5a9dcf53040a565 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 28 Jan 2025 09:20:35 +0100 Subject: [PATCH] tool_getparam: fail --hostpubsha256 if libssh2 is not used Reported-by: Harry Sintonen Closes #16109 --- src/tool_getparam.c | 5 ++++- src/tool_libinfo.c | 3 +++ src/tool_libinfo.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tool_getparam.c b/src/tool_getparam.c index eb54d707a0..0ae1466d5c 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -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); diff --git a/src/tool_libinfo.c b/src/tool_libinfo.c index ff3117a038..9da5075b92 100644 --- a/src/tool_libinfo.c +++ b/src/tool_libinfo.c @@ -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; } diff --git a/src/tool_libinfo.h b/src/tool_libinfo.h index 003ed0140c..5e6e1de24c 100644 --- a/src/tool_libinfo.h +++ b/src/tool_libinfo.h @@ -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; -- 2.47.3