On Fri, May 04, 2018 at 12:53:14PM -0400, John Ferlan wrote: > > > On 05/01/2018 12:21 PM, Julio Faracco wrote: > > After 0.7.5 release, libssh deprecated ssh_get_publickey() method to > > introduce ssh_get_server_publickey(). This commit check the current > > version of libssh and use the proper method during the compilation. > > See the error: > > > > make[3]: Entering directory '/home/julio/Desktop/virt/libvirt/src' > > CC rpc/libvirt_net_rpc_la-virnetlibsshsession.lo > > rpc/virnetlibsshsession.c:217:9: error: 'ssh_get_publickey' is deprecated [-Werror,-Wdeprecated-declarations] > > if (ssh_get_publickey(sess->session, &key) != SSH_OK) { > > ^ > > /usr/include/libssh/libssh.h:489:1: note: 'ssh_get_publickey' has been explicitly marked deprecated here > > SSH_DEPRECATED LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key); > > ^ > > /usr/include/libssh/libssh.h:99:40: note: expanded from macro 'SSH_DEPRECATED' > > ^ > > 1 error generated. > > Makefile:8604: recipe for target 'rpc/libvirt_net_rpc_la-virnetlibsshsession.lo' failed > > > > Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx> > > --- > > src/rpc/virnetlibsshsession.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c > > index 309e8a9340..96c5bc0882 100644 > > --- a/src/rpc/virnetlibsshsession.c > > +++ b/src/rpc/virnetlibsshsession.c > > @@ -214,7 +214,11 @@ virLibsshServerKeyAsString(virNetLibsshSessionPtr sess) > > size_t keyhashlen; > > char *str; > > > > +#if LIBSSH_VERSION_INT > 0x0705 /* 0.7.5 */ > > + if (ssh_get_server_publickey(sess->session, &key) != SSH_OK) { > > +#else > > if (ssh_get_publickey(sess->session, &key) != SSH_OK) { > > +#endif > > Usually this involves changes to some m4/* file that would do the > version check and existence of some API and set a WITH_xxx or HAVE_xxx > type conditional which would then be used. That all depends on whether we care about handling the possibility of distros backporting the function to older versions of libssh. This kind of backporting happens alot for some projects, like QEMU, but not for others. IMHO this check against LIBSSH_VERSION_INT is fine. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list