From aa46a438d03839963badb7bdd2904a71f0662942 Mon Sep 17 00:00:00 2001 Message-Id: From: Pavel Hrdina Date: Fri, 21 Jun 2019 09:30:36 +0200 Subject: [PATCH] rpc: virnetlibsshsession: update deprecated functions In libssh 0.9.0 functions ssh_is_server_known and ssh_write_knownhost are marked as deprecated. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1722735 Signed-off-by: Pavel Hrdina Message-Id: Reviewed-by: Jiri Denemark --- m4/virt-libssh.m4 | 8 ++++++++ src/rpc/virnetlibsshsession.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/m4/virt-libssh.m4 b/m4/virt-libssh.m4 index 01c3b75c72..132447da16 100644 --- a/m4/virt-libssh.m4 +++ b/m4/virt-libssh.m4 @@ -33,6 +33,14 @@ AC_DEFUN([LIBVIRT_CHECK_LIBSSH],[ [], [AC_DEFINE_UNQUOTED([ssh_get_server_publickey], [ssh_get_publickey], [ssh_get_publickey is deprecated and replaced by ssh_get_server_publickey.])]) + AC_CHECK_FUNC([ssh_session_is_known_server], + [], + [AC_DEFINE_UNQUOTED([ssh_session_is_known_server], [ssh_is_server_known], + [ssh_is_server_known is deprecated and replaced by ssh_session_is_known_server.])]) + AC_CHECK_FUNC([ssh_session_update_known_hosts], + [], + [AC_DEFINE_UNQUOTED([ssh_session_update_known_hosts], [ssh_write_knownhost], + [ssh_write_knownhost is deprecated and replaced by ssh_session_update_known_hosts.])]) CFLAGS="$old_CFLAGS" LIBS="$old_LIBS" fi diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c index df819f6169..7bc2bd33ee 100644 --- a/src/rpc/virnetlibsshsession.c +++ b/src/rpc/virnetlibsshsession.c @@ -287,7 +287,7 @@ virNetLibsshCheckHostKey(virNetLibsshSessionPtr sess) if (sess->hostKeyVerify == VIR_NET_LIBSSH_HOSTKEY_VERIFY_IGNORE) return 0; - state = ssh_is_server_known(sess->session); + state = ssh_session_is_known_server(sess->session); switch (state) { case SSH_SERVER_KNOWN_OK: @@ -381,7 +381,7 @@ virNetLibsshCheckHostKey(virNetLibsshSessionPtr sess) /* write the host key file, if specified */ if (sess->knownHostsFile) { - if (ssh_write_knownhost(sess->session) < 0) { + if (ssh_session_update_known_hosts(sess->session) < 0) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, _("failed to write known_host file '%s': %s"), -- 2.22.0