]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: Require libssh-0.8.1 or newer
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 7 Sep 2022 13:08:20 +0000 (15:08 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 20 Sep 2022 07:34:52 +0000 (09:34 +0200)
According to repology.org:

              RHEL-8: 0.9.4
              RHEL-9: 0.9.6
           Debian 11: 0.9.5
  openSUSE Leap 15.3: 0.8.7
        Ubuntu 20.04: 0.9.3

And the rest of distros has something newer anyways. Requiring
0.8.1 or newer allows us to drop the terrible hack where we
rename functions at meson level using #define. Note, 0.8.0 is
the version of libssh where the rename happened. It also allows
us to stick with SHA-256 hash algorithm for public keys.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
libvirt.spec.in
meson.build
src/rpc/virnetlibsshsession.c

index b199c624b89f0e604b88b4db01b6ec718f5e2300..654057bf57bf652cf7f42b7e2da588066a1f31ba 100644 (file)
@@ -378,7 +378,7 @@ BuildRequires: wireshark-devel
 %endif
 
 %if %{with_libssh}
-BuildRequires: libssh-devel >= 0.7.0
+BuildRequires: libssh-devel >= 0.8.1
 %endif
 
 BuildRequires: rpcgen
index ed9f4b3f7061a67f69675853fb8834a0dba5a2a1..24b12515c2d830005f73bb338b19a1c2399305da 100644 (file)
@@ -1025,24 +1025,11 @@ else
   libpcap_dep = dependency('', required: false)
 endif
 
-libssh_version = '0.7'
+libssh_version = '0.8.1'
 if conf.has('WITH_REMOTE')
   libssh_dep = dependency('libssh', version: '>=' + libssh_version, required: get_option('libssh'))
   if libssh_dep.found()
     conf.set('WITH_LIBSSH', 1)
-
-    # Check if new functions exists, if not redefine them with old deprecated ones.
-    # List of [ new_function, deprecated_function ].
-    functions = [
-      [ 'ssh_get_server_publickey', 'ssh_get_publickey' ],
-      [ 'ssh_session_is_known_server', 'ssh_is_server_known' ],
-      [ 'ssh_session_update_known_hosts', 'ssh_write_knownhost' ],
-    ]
-    foreach name : functions
-      if not cc.has_function(name[0], dependencies: libssh_dep)
-        conf.set(name[0], name[1])
-      endif
-    endforeach
   endif
 else
   libssh_dep = dependency('', required: false)
index a3adc857287db9992b887cea6d48a81c75bf36ee..b1420bea2cca35cf204bbf34619c35a617effd4b 100644 (file)
@@ -39,12 +39,6 @@ VIR_LOG_INIT("rpc.netlibsshsession");
 
 #define VIR_NET_LIBSSH_BUFFER_SIZE  1024
 
-#if LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 8, 1)
-# define VIR_SSH_HOSTKEY_HASH SSH_PUBLICKEY_HASH_SHA1
-#else
-# define VIR_SSH_HOSTKEY_HASH SSH_PUBLICKEY_HASH_SHA256
-#endif
-
 /* TRACE_LIBSSH=<level> enables tracing in libssh itself.
  * The meaning of <level> is described here:
  * https://api.libssh.org/master/group__libssh__log.html
@@ -212,7 +206,7 @@ virLibsshServerKeyAsString(virNetLibsshSession *sess)
     /* calculate remote key hash, using SHA256 algorithm that is
      * the default in modern OpenSSH, fallback to SHA1 for older
      * libssh. The returned value must be freed */
-    ret = ssh_get_publickey_hash(key, VIR_SSH_HOSTKEY_HASH,
+    ret = ssh_get_publickey_hash(key, SSH_PUBLICKEY_HASH_SHA256,
                                  &keyhash, &keyhashlen);
     ssh_key_free(key);
     if (ret < 0) {