]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: fail --hostpubsha256 if libssh2 is not used
authorDaniel Stenberg <daniel@haxx.se>
Tue, 28 Jan 2025 08:20:35 +0000 (09:20 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 28 Jan 2025 09:30:40 +0000 (10:30 +0100)
Reported-by: Harry Sintonen
Closes #16109

src/tool_getparam.c
src/tool_libinfo.c
src/tool_libinfo.h

index eb54d707a0a79fd7693445938e5d67515c3be639..0ae1466d5ce32d508bea8567e22d2ca0a06c4bdc 100644 (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);
index ff3117a0382c5a70f22636ba357997d959828e79..9da5075b9258a11b59f4ab35f86c98779431cf02 100644 (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;
 }
 
index 003ed0140c8ac5d0527d2d8364192f826edf0a6b..5e6e1de24c43f2e8108cc13f76edfbdadd97f0dc 100644 (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;