On Wed, 2018-05-09 at 07:42 -0300, Julio Faracco wrote:
[...]
+#if LIBSSH_VERSION_INT <= 0x0705 /* 0.7.5 */
+# define ssh_get_server_publickey ssh_get_publickey
+#endif
+
+ if (ssh_get_server_publickey(sess->session, &key) != SSH_OK) {
virReportError(VIR_ERR_LIBSSH, "%s",
_("failed to get the key of the current "
"session"));
This won't work.
Looking at libssh.h on Fedora 28 (libssh-devel 0.7.5-7.fc28):
#define LIBSSH_VERSION_MAJOR 0
#define LIBSSH_VERSION_MINOR 7
#define LIBSSH_VERSION_MICRO 5
LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
but on Debian sid (libssh-gcrypt-dev 0.8.0~20170825.94fa1e38-1):
#define LIBSSH_VERSION_MAJOR 0
#define LIBSSH_VERSION_MINOR 7
#define LIBSSH_VERSION_MICRO 0
LIBSSH_API int ssh_get_server_publickey(ssh_session session, ssh_key *key);
SSH_DEPRECATED LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
Unsurprisingly, even after applying your patch libvirt fails to
build on the latter.
Not sure what's going on with the version number in the header
disagreeing with the one in the package manager, but it clearly
shows checking for the version number is not the way to go.
I think you should add a configure-time check for the availability
of the ssh_get_server_publickey() function instead, and then change
your code to
#ifndef HAVE_SSH_GET_SERVER_PUBLICKEY
# define ssh_get_server_publickey ssh_get_publickey
#endif
While at it, please move it towards the top of the file rather
than in the middle of the function body, please :)
--
Andrea Bolognani / Red Hat / Virtualization