From nobody Sat Feb 7 21:15:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1596822105; cv=none; d=zohomail.com; s=zohoarc; b=DRwkRZzFUbR5jxsPyAC2+XsEaCnzB0InLKXbMhAfox6ElPh467SCgNG6qi0PjJExzn21cEhHez0oKBN+NZww3dMpLBr/BNl4KES18+pGfZ5cJ+PNrbHWrhu/M/HJrNR9ZCTfoG8gFjdZPDkBew8PvFUgCfkgcBRQbpH6cT4J8zk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596822105; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pdQpj6h6Y8lKuPuM7iJeOZh+C1yC9paCjTtT9x08HkE=; b=H1KhNIc52LJ3x71R9vklN0qIsqqgGqgBTjidZ+LAoh5cIE6Hdcx4oWJEFycFdKBtMSaYyBoR+2MU3NiBqMLCDWBM6J2lQ9rCOM5v7EduqqIiOjd44pSQ5h0vnYailT7knxqa6Hned9PrROej79TiUKW0Y8si1ZALiASLpSRdOMQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 15968221055161020.2607851708484; Fri, 7 Aug 2020 10:41:45 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-342-H7NgtscQMGyIOr3bnbiUcg-1; Fri, 07 Aug 2020 13:41:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12F5C101C8A5; Fri, 7 Aug 2020 17:41:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E48592DE7F; Fri, 7 Aug 2020 17:41:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6D9B99693C; Fri, 7 Aug 2020 17:41:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 077Hf7iM017660 for ; Fri, 7 Aug 2020 13:41:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id C81945DA30; Fri, 7 Aug 2020 17:41:07 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCAC05D9D5; Fri, 7 Aug 2020 17:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596822104; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pdQpj6h6Y8lKuPuM7iJeOZh+C1yC9paCjTtT9x08HkE=; b=WgLe2g3Z46QTl8uFO0cbmdG/lkp6jZPdXGC3qoiU7Qb+xzeoBRa1h2oew3+Hdu+1u19Ts1 7TasRfIqy7zr82S4EuQVOiY+NvVQ86TnSBfBmBUjaFVFxaWfblhHJ7mcadSDPoXFpMgiWg jD2pwg3xiPkb1/GE5Cru0JzAROrNXsI= X-MC-Unique: H7NgtscQMGyIOr3bnbiUcg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v4 02/11] remote: push logic for default netcat binary into common helper Date: Fri, 7 Aug 2020 18:40:50 +0100 Message-Id: <20200807174059.312786-3-berrange@redhat.com> In-Reply-To: <20200807174059.312786-1-berrange@redhat.com> References: <20200807174059.312786-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) We don't want to repeat the choice of default netcat binary setting in three different places. This will also make it possible to do better error reporting in the helper. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/remote/remote_driver.c | 2 +- src/rpc/virnetclient.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 0331060a2d..f511a9bc33 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1226,7 +1226,7 @@ doRemoteOpen(virConnectPtr conn, username, !tty, !verify, - netcat ? netcat : "nc", + netcat, keyfile, sockname))) goto failed; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index bd818df953..f65cda0d7f 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -419,6 +419,9 @@ virNetClientSSHHelperCommand(const char *netcatPath, { g_autofree char *netcatPathSafe =3D virNetClientDoubleEscapeShell(netc= atPath); =20 + if (!netcatPath) + netcatPath =3D "nc"; + return g_strdup_printf( "sh -c " "'if '%s' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1;= then " @@ -505,7 +508,6 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host, DEFAULT_VALUE(host, "localhost"); DEFAULT_VALUE(port, "22"); DEFAULT_VALUE(username, "root"); - DEFAULT_VALUE(netcatPath, "nc"); DEFAULT_VALUE(knownHostsVerify, "normal"); =20 command =3D virNetClientSSHHelperCommand(netcatPath, socketPath); @@ -566,7 +568,6 @@ virNetClientPtr virNetClientNewLibssh(const char *host, DEFAULT_VALUE(host, "localhost"); DEFAULT_VALUE(port, "22"); DEFAULT_VALUE(username, "root"); - DEFAULT_VALUE(netcatPath, "nc"); DEFAULT_VALUE(knownHostsVerify, "normal"); =20 command =3D virNetClientSSHHelperCommand(netcatPath, socketPath); --=20 2.26.2