]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh2: use non-deprecated `libssh2_knownhost_addc()`
authorViktor Szakats <commit@vsz.me>
Fri, 5 Jun 2026 00:35:58 +0000 (02:35 +0200)
committerViktor Szakats <commit@vsz.me>
Fri, 5 Jun 2026 10:06:22 +0000 (12:06 +0200)
Supported since libssh2 v1.2.5. Replacing `libssh2_knownhost_add()`,
which was deprecated in that same version.

The new API supports a comment field.

Ref: https://github.com/libssh2/libssh2/pull/1977

Closes #21866

lib/vssh/libssh2.c

index 31c3024449f1ca3bbb626a89657afa5c73037c7c..4a401edd2dd800e0721f7f1943b1f48725cbf28a 100644 (file)
@@ -427,12 +427,13 @@ static CURLcode ssh_knownhost(struct Curl_easy *data,
       if(keycheck != LIBSSH2_KNOWNHOST_CHECK_MATCH) {
         /* the found host+key did not match but has been told to be fine
            anyway so we add it in memory */
-        int addrc = libssh2_knownhost_add(sshc->kh,
-                                          conn->origin->hostname, NULL,
-                                          remotekey, keylen,
-                                          LIBSSH2_KNOWNHOST_TYPE_PLAIN|
-                                          LIBSSH2_KNOWNHOST_KEYENC_RAW|
-                                          keybit, NULL);
+        int addrc = libssh2_knownhost_addc(sshc->kh,
+                                           conn->origin->hostname, NULL,
+                                           remotekey, keylen,
+                                           NULL, 0,
+                                           LIBSSH2_KNOWNHOST_TYPE_PLAIN |
+                                           LIBSSH2_KNOWNHOST_KEYENC_RAW |
+                                           keybit, NULL);
         if(addrc)
           infof(data, "WARNING: adding the known host %s failed",
                 conn->origin->hostname);