From nobody Sun Apr 28 20:32:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1643211854; cv=none; d=zohomail.com; s=zohoarc; b=H52LMBKXkVDVURpAEFlS+t+fbRcQSII0dQb59v+exPjWeNp525spBXIpDuMObPylZKGRblXCJaR7CHgE5wZyHNeTZY4mZz/ij10DE3Q9rnnlo2xyqqKQiEiAJkuTDcLv76kb/YPOOd4B9KS0dslaVYTldLx6c7qseWGs0OuJcq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643211854; 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=5eTK1YItz4tGHrhDx6jUw2qziXakEgYfsGHYt4GuVuk=; b=I/mmjdpRWxtJ4Csdkg0QjCMDMmJq1aM0QLEVCQiNsrnLsmIZMFLRNPnVYMJBToLI1KzgO8ffFEqNHdlnTWnmzQEVZ3dMtBtCA6Lhu3utYos5pFB05i+9qQSPyU9AHG2eruPdaOA74mHHfUlWMnb7ifvGmnj90rfr/HvKj0clX0I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1643211854235661.2233365739324; Wed, 26 Jan 2022 07:44:14 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-646-npQzFt1oPwawVPy8dVlO1w-1; Wed, 26 Jan 2022 10:44:09 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E83548143F2; Wed, 26 Jan 2022 15:44:03 +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 41C8C70D43; Wed, 26 Jan 2022 15:44:03 +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 940ED1809CB8; Wed, 26 Jan 2022 15:44:01 +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 20QFhx8P019776 for ; Wed, 26 Jan 2022 10:43:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id EC75523767; Wed, 26 Jan 2022 15:43:59 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.194.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51D072C1AA for ; Wed, 26 Jan 2022 15:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643211853; 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=5eTK1YItz4tGHrhDx6jUw2qziXakEgYfsGHYt4GuVuk=; b=Ofwhu9T9hyUNba7EeTs0KZqAUfR+qZ9W6tAIZFvrV+fc5/81tPCD7kvTksyKk6zEQ6KxgM /+qi5zFVtsWGSa0fBcKq+h+WFhqB8rz5i/b2XM9lTaWZ+GRG2sUo9xSeki9mOP+xvB37zW Qi5/LVUBqdVAJbzsBt1q4hGKpWjQ244= X-MC-Unique: npQzFt1oPwawVPy8dVlO1w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] virsh: domsetlaunchsecstate: mark options as mandatory Date: Wed, 26 Jan 2022 16:43:52 +0100 Message-Id: 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.11 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) X-ZM-MESSAGEID: 1643211855944100001 We exit if they are not present. Let the virsh option parser do the checking instead of checking it manually. Change the type to OT_DATA (i.e. a mandatory string), mark them as required and remove VSH_OFLAG_REQ_OPT so that the header file and the secret file can be specified without the option names. https://bugzilla.redhat.com/show_bug.cgi?id=3D2046024 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tools/virsh-domain.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index b56f6a90f5..d279af68b2 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9587,13 +9587,13 @@ static const vshCmdInfo info_domsetlaunchsecstate[]= =3D { static const vshCmdOptDef opts_domsetlaunchsecstate[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "secrethdr", - .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, .help =3D N_("path to file containing the secret header"), }, {.name =3D "secret", - .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, .help =3D N_("path to file containing the secret"), }, {.name =3D "set-address", @@ -9627,9 +9627,6 @@ cmdDomSetLaunchSecState(vshControl * ctl, const vshCm= d * cmd) if (vshCommandOptStringReq(ctl, cmd, "secret", &secfile) < 0) return false; =20 - if (sechdrfile =3D=3D NULL || secfile =3D=3D NULL) - return false; - if (virFileReadAll(sechdrfile, 1024*64, &sechdr) < 0) { vshSaveLibvirtError(); return false; --=20 2.31.1