From nobody Sun Feb 8 07:08:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1595603718; cv=none; d=zohomail.com; s=zohoarc; b=c2P3F1ZQboTQbNYuXT2cjlwU97mPWKCfx/voZ+AyzgAEV4YonVg6S66sBgS9PY94t+WezHfDn/NoqB8YXdfye0hwX1Flvlt9T5MMHSH2JtWwMneQpMnNQP0xl1NTWh2y7na9En+JYn4wmy5bWR/LObTM4kf8c9CQcVIs8ARHWUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595603718; 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=cC+YkE7/7h0Zn9b+mqQ1jo35zQW83SIFIMbNe1wqR4g=; b=NLa2FdJPNMrCmFtxgHI4xUQr8U2p6w2gd+RW1oi9w19FYprkpFWfyr/2Ly2hOiVECFEjiKbKFqG22hOs+eD+iw1oL2kmvkvgo9vw8i7JVBnt51eedGngM4jzulkt7h/OfMQsOlVTBXrSRcozPnlAf4pkiOAz5sNaFN/bkWfhcNk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1595603718580134.66888755426135; Fri, 24 Jul 2020 08:15:18 -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-80-VMPYrIIFOF2jmPjzZrmZ5A-1; Fri, 24 Jul 2020 11:15:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C521291272; Fri, 24 Jul 2020 15:15:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D74870597; Fri, 24 Jul 2020 15:15:07 +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 468C91809563; Fri, 24 Jul 2020 15:15:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06OFEMR7023114 for ; Fri, 24 Jul 2020 11:14:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0F23E2DE81; Fri, 24 Jul 2020 15:14:22 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DD892DE7F; Fri, 24 Jul 2020 15:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595603717; 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=cC+YkE7/7h0Zn9b+mqQ1jo35zQW83SIFIMbNe1wqR4g=; b=Zrk49mjbejDodDQUc4VlPDezftvcfGCyYAMkFY5EUcOeJX2OgjgXYbKcCLyAxM3M1RLMA9 hNhqyEuhjTDVrrIET4pyV5x31BvPRxz/NvlSPHYqhXWd3YbjE0JK+oZlqNnnfUrLmmMrQR 0PJS96DVYjogjk+1Aat/0ysfjlnpEjw= X-MC-Unique: VMPYrIIFOF2jmPjzZrmZ5A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 02/10] remote: push logic for default netcat binary into common helper Date: Fri, 24 Jul 2020 16:14:06 +0100 Message-Id: <20200724151414.3380935-3-berrange@redhat.com> In-Reply-To: <20200724151414.3380935-1-berrange@redhat.com> References: <20200724151414.3380935-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.79 on 10.5.11.12 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 653c68472a..c8f5858bd1 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