summaryrefslogtreecommitdiff
path: root/lib/setopt.c
diff options
context:
space:
mode:
authormichael musset <mickamusset@gmail.com>2021-11-04 15:55:47 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-06-02 08:34:31 +0200
commit1544513958d9691f6ed576dfb3ff9f8c2a0de372 (patch)
tree2c8d0566bb542fab564d4ce8eb9f74595508c387 /lib/setopt.c
parent267d560b5ae4e73ea99f8211a2e8d0fa1305d9ea (diff)
downloadcurl-1544513958d9691f6ed576dfb3ff9f8c2a0de372.tar.gz
libssh2: add CURLOPT_SSH_HOSTKEYFUNCTION
The callback set by CURLOPT_SSH_HOSTKEYFUNCTION is called to check wether or not the connection should continue. The host key is passed in argument with a custom handle for the application. It overrides CURLOPT_SSH_KNOWNHOSTS Closes #7959
Diffstat (limited to 'lib/setopt.c')
-rw-r--r--lib/setopt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/setopt.c b/lib/setopt.c
index 19201393f..7dd9b5756 100644
--- a/lib/setopt.c
+++ b/lib/setopt.c
@@ -2466,7 +2466,19 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
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);
+ break;
+ case CURLOPT_SSH_HOSTKEYDATA:
+ /*
+ * Custom client data to pass to the SSH keyfunc callback
+ */
+ data->set.ssh_hostkeyfunc_userp = va_arg(param, void *);
+ break;
+#endif
case CURLOPT_SSH_KEYFUNCTION:
/* setting to NULL is fine since the ssh.c functions themselves will
then revert to use the internal default */