]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
setopt: move the SHA256 opt within #ifdef libssh2
authorDaniel Stenberg <daniel@haxx.se>
Sat, 7 Jan 2023 14:49:03 +0000 (15:49 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 7 Jan 2023 22:01:52 +0000 (23:01 +0100)
Because only the libssh2 backend not supports it and thus this should
return error if this option is used other backends.

Reported-by: Harry Sintonen
Closes #10255

docs/cmdline-opts/hostpubsha256.d
lib/setopt.c

index 22b31e0c9e10576382bb6bebea196ac287ea6bf3..ba33318f9cdb3271592762291b12402b0cc0dc19 100644 (file)
@@ -13,3 +13,6 @@ Multi: single
 Pass a string containing a Base64-encoded SHA256 hash of the remote
 host's public key. Curl will refuse the connection with the host
 unless the hashes match.
+
+This feature requires libcurl to be built with libssh2 and does not work with
+other SSH backends.
index a9f3c197707bf9da7dc65e028e479049641d2bdf..b897af1009ce42b2b1b66e397f715df84c8014d4 100644 (file)
@@ -2531,6 +2531,14 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
                             va_arg(param, char *));
     break;
 
+  case CURLOPT_SSH_KNOWNHOSTS:
+    /*
+     * Store the file name to read known hosts from.
+     */
+    result = Curl_setstropt(&data->set.str[STRING_SSH_KNOWNHOSTS],
+                            va_arg(param, char *));
+    break;
+#ifdef USE_LIBSSH2
   case CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256:
     /*
      * Option to allow for the SHA256 of the host public key to be checked
@@ -2540,14 +2548,6 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
                             va_arg(param, char *));
     break;
 
-  case CURLOPT_SSH_KNOWNHOSTS:
-    /*
-     * Store the file name to read known hosts from.
-     */
-    result = Curl_setstropt(&data->set.str[STRING_SSH_KNOWNHOSTS],
-                            va_arg(param, char *));
-    break;
-#ifdef USE_LIBSSH2
   case CURLOPT_SSH_HOSTKEYFUNCTION:
     /* the callback to check the hostkey without the knownhost file */
     data->set.ssh_hostkeyfunc = va_arg(param, curl_sshhostkeycallback);