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