From nobody Sun Feb 8 01:33:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1596710943; cv=none; d=zohomail.com; s=zohoarc; b=OqZ0EmqzU626X78z0KjCH8Q+js8zVmtSLTCu+NSbP9wadHbcNDxTi68r4/VnTHPA4AgLwoZcvMzNQGq5fvVnXVIJKyMQJW69GNuF8yF34aKeAN9ZF1pIKpakbZGfd3BdHRPLsQVufUzMDQ21BIYEWpt9vPftN3IJKVoNJYexUFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596710943; 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=jeLj++bDRxL0iUPO+ta/uRvyrHodCIcbZ/tM4XDW7of6h0nqOXmOvpiWfWgxgfU6vrY0mMLhP5lmXLQr6XTnRot3dkq4uxbPw8hQL3BZLCYq0ZLn8/eL+IrdWWI7D3SdEjH9QGspzVsrgcuAoiyMMu51gWAZFGtKxebG76aIYFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1596710943418110.98360610361817; Thu, 6 Aug 2020 03:49:03 -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-24-R8WydgscNGyQ6nHNEPPrcw-1; Thu, 06 Aug 2020 06:48:59 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0FC1018C63DC; Thu, 6 Aug 2020 10:48:54 +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 E07B05D9DC; Thu, 6 Aug 2020 10:48:53 +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 AE5321809563; Thu, 6 Aug 2020 10:48:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 076AjsHi031656 for ; Thu, 6 Aug 2020 06:45:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB8C37B93A; Thu, 6 Aug 2020 10:45:54 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FD3C7B925; Thu, 6 Aug 2020 10:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596710942; 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=fAPzwrI1Eh8wtmbBEHR93WydedpwyJrpCY+pdb5++y+zBI7+UZw6vNyA98eMRjy8jyBA7P SzHE/dbNAWoy7zyqVjQLpxIQba+aN0nFLFJsnyx6tJi8UBcNlO6lXDTt5V3mpZgji1q8/k aSZ7KGGD4GV5GM20bCDQNAraEWHJJfg= X-MC-Unique: R8WydgscNGyQ6nHNEPPrcw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v3 02/10] remote: push logic for default netcat binary into common helper Date: Thu, 6 Aug 2020 11:45:37 +0100 Message-Id: <20200806104545.73447-3-berrange@redhat.com> In-Reply-To: <20200806104545.73447-1-berrange@redhat.com> References: <20200806104545.73447-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.14 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