From nobody Sun May 19 08:26:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663575509; cv=none; d=zohomail.com; s=zohoarc; b=euU7F3k+4+r4dhbPGXBpW0AmpxscfkXRwErm76mLnNW93Wm+Fj2TeSmH29f9yKoOevuwMugNxE9xVbl+0r/t/Pv8Bn5XD6jllSXuBDfF7MQpUMeQ7rexFIgDiseyi4XuiZcTvxIYrvVI+lw1nlkJTEHvBcIM640SImsrZ1Xigek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663575509; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=H0hevFeWEtYAWVCCLRID67NZhPafxrv7u2hjr/qgsH0=; b=AkOB6ofRwrTDsQCNj/oZ8mhB/e6YTCfVz3YMwnwYUlimIamVjI9QaKC3x0jGdmGBvJqrLEgDRNEVz/F2wJmaKhvZJYQfUqfZ5t/2ohY5u91C8EshjnHwJtbo6q2PJsNQtctVB/IAuF+bboyNHIRkr0gcqg87T3kxidBTeOSw53w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1663575509077125.27643668852511; Mon, 19 Sep 2022 01:18:29 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-B42HwJWPOC6DyftJuGEgnA-1; Mon, 19 Sep 2022 04:18:24 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6FBE53803906; Mon, 19 Sep 2022 08:18:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8F842166B26; Mon, 19 Sep 2022 08:18:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 863841946594; Mon, 19 Sep 2022 08:18:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 962ED1946586 for ; Mon, 19 Sep 2022 08:18:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7584F40C2065; Mon, 19 Sep 2022 08:18:20 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D79F40C2064 for ; Mon, 19 Sep 2022 08:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663575508; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=H0hevFeWEtYAWVCCLRID67NZhPafxrv7u2hjr/qgsH0=; b=YXZDBIAd08qb25t0/fvzbx0rEPcwBG1g8x+CXC6YtAp1RhZrXv2E6ihiF+yXsogQ7so0MD UFR9kb/AeyKlPnGar0YLVtESqTjHNTxLtKrJJhAI3geGyw0t542qE57gK4YPMImRvnZec2 laiEYPX3PN9g28mkW40/jiu5d0cWqZ8= X-MC-Unique: B42HwJWPOC6DyftJuGEgnA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2] meson: Require libssh-0.8.1 or newer Date: Mon, 19 Sep 2022 10:18:18 +0200 Message-Id: <2ec66d2dc833c8ff067da16cf0d32e400c6c33b4.1663575430.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1663575509980100001 Content-Type: text/plain; charset="utf-8"; x-default="true" 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 Reviewed-by: J=C3=A1n Tomko --- v2 of: https://listman.redhat.com/archives/libvir-list/2022-September/234296.html diff to v1: - Require even newer version so that more code can be dropped. libvirt.spec.in | 2 +- meson.build | 15 +-------------- src/rpc/virnetlibsshsession.c | 8 +------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index b199c624b8..654057bf57 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -378,7 +378,7 @@ BuildRequires: wireshark-devel %endif =20 %if %{with_libssh} -BuildRequires: libssh-devel >=3D 0.7.0 +BuildRequires: libssh-devel >=3D 0.8.1 %endif =20 BuildRequires: rpcgen diff --git a/meson.build b/meson.build index ed9f4b3f70..24b12515c2 100644 --- a/meson.build +++ b/meson.build @@ -1025,24 +1025,11 @@ else libpcap_dep =3D dependency('', required: false) endif =20 -libssh_version =3D '0.7' +libssh_version =3D '0.8.1' if conf.has('WITH_REMOTE') libssh_dep =3D dependency('libssh', version: '>=3D' + libssh_version, re= quired: get_option('libssh')) if libssh_dep.found() conf.set('WITH_LIBSSH', 1) - - # Check if new functions exists, if not redefine them with old depreca= ted ones. - # List of [ new_function, deprecated_function ]. - functions =3D [ - [ '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 =3D dependency('', required: false) diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c index a3adc85728..b1420bea2c 100644 --- a/src/rpc/virnetlibsshsession.c +++ b/src/rpc/virnetlibsshsession.c @@ -39,12 +39,6 @@ VIR_LOG_INIT("rpc.netlibsshsession"); =20 #define VIR_NET_LIBSSH_BUFFER_SIZE 1024 =20 -#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=3D enables tracing in libssh itself. * The meaning of 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 =3D ssh_get_publickey_hash(key, VIR_SSH_HOSTKEY_HASH, + ret =3D ssh_get_publickey_hash(key, SSH_PUBLICKEY_HASH_SHA256, &keyhash, &keyhashlen); ssh_key_free(key); if (ret < 0) { --=20 2.35.1