From nobody Sun Feb 8 07:07:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1607349478; cv=none; d=zohomail.com; s=zohoarc; b=dOmiv5/5TBx3uLzYXILVi+a9vxwKrKqRyLlcTFuUB1SzJD/RH/W9XsYIRg8nv2fT3vmeAsJ85qdTo+9yIYRX6TeFy0eZnTZSKFJWalnM//zxd7oVBbDbIdoNF3OERI6529SwpiMJIcuzCvUTmkBrji6ltCB0amMZO5eYCohjYbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607349478; h=Content-Type:Content-Transfer-Encoding:Cc: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=XYP+Xrjovt+xKQqP3t0kvin0RA36VzX7sAvd7nBWJI8=; b=NrJW9VA4sq+ZrWMyzNrjTgya/7uXHrpmxaonFagYg4vQ4wmy6DvFr3f8AZwtohMfkD8jefmb94OrdA3yAs5dTbzSk+tBlb/O3KP1rQJmJyfdgkpGQrisQgMpIxD4c60h2FtMNIEGvkq8f90++YpzmxANlf0rNtlB8N0s+Z68wG8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607349478118332.610150052638; Mon, 7 Dec 2020 05:57:58 -0800 (PST) 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-345-qPWEZ1QnMQuAbtNAKdxbRQ-1; Mon, 07 Dec 2020 08:55:32 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94B651E7E9; Mon, 7 Dec 2020 13:55:25 +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 43E606EF41; Mon, 7 Dec 2020 13:55:25 +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 03EA01809CA2; Mon, 7 Dec 2020 13:55:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7Dt1H9012960 for ; Mon, 7 Dec 2020 08:55:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 73ECF6B42D; Mon, 7 Dec 2020 13:55:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E0806379C for ; Mon, 7 Dec 2020 13:55:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5B0D485829F for ; Mon, 7 Dec 2020 13:55:01 +0000 (UTC) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-430-7jmFUrRiPNmB2lXgYycSfw-1; Mon, 07 Dec 2020 08:54:59 -0500 Received: by mail-qk1-f196.google.com with SMTP id 19so4913757qkm.8 for ; Mon, 07 Dec 2020 05:54:59 -0800 (PST) Received: from rekt.redhat.com ([2804:431:c7c7:c1a:69c1:2b22:e880:fc49]) by smtp.gmail.com with ESMTPSA id n95sm12233701qte.43.2020.12.07.05.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 05:54:58 -0800 (PST) X-MC-Unique: qPWEZ1QnMQuAbtNAKdxbRQ-1 X-MC-Unique: 7jmFUrRiPNmB2lXgYycSfw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XYP+Xrjovt+xKQqP3t0kvin0RA36VzX7sAvd7nBWJI8=; b=Ny5LuE7zyi8rfUdTJgeKx6stxY86TXkeXrj8WDPSvO9B2UlFvrK5bt38RVtGcRl1u1 bWtnqIqquY9fmjDueQUzftszrBFU9FYMac1xaZteDqfkIO6KSwejXdHcWflz1Y9ss1j1 DkDRZrwDZtmzeissKsDrbBkSkYchAExiLTsBoqdPh5Cm72ugd+8RL7Pi3VDAjvmyeJFP Kp1BbaH7JRergg4v+OfT7QQBOZc+ja92LYsDU/kZVb4xcoAdNDGqMi6MnZsk/g5mRNl1 0FafSwpDOqhCW+UaSe7mKweza1X6ZL+d+vgM1zFKxinN/nd6z+2F0JVVzX0B3qoQASXo g12A== X-Gm-Message-State: AOAM533Mn9WXhhqfs/3zGur827CNyIN1msutxIPWMQorMvT8hXt4j4yg w8imc431fA7IFAaNycY0lYbpO05AV3o= X-Google-Smtp-Source: ABdhPJyZ5teUD8go1AUpm6lbH1+aea3QbtEBbzJqGfSWrA4K9Akjr678RU8UyiPAwbg07FOmjjLRoQ== X-Received: by 2002:a05:620a:882:: with SMTP id b2mr24218157qka.118.1607349298564; Mon, 07 Dec 2020 05:54:58 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v2 5/9] domain_conf.c: move smartcard address check to validate callback Date: Mon, 7 Dec 2020 10:54:31 -0300 Message-Id: <20201207135435.884594-6-danielhb413@gmail.com> In-Reply-To: <20201207135435.884594-1-danielhb413@gmail.com> References: <20201207135435.884594-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.13 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This check is not tied to XML parsing and can be moved to virDomainSmartcardDefValidate(). Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e9bafd189f..230e89e786 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6567,6 +6567,13 @@ static int virDomainSmartcardDefValidate(const virDomainSmartcardDef *smartcard, const virDomainDef *def) { + if (smartcard->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + smartcard->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Controllers must use the 'ccid' address type")); + return -1; + } + if (smartcard->type =3D=3D VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH) return virDomainChrSourceDefValidate(smartcard->data.passthru, NUL= L, def); =20 @@ -13682,13 +13689,6 @@ virDomainSmartcardDefParseXML(virDomainXMLOptionPt= r xmlopt, if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) return NULL; =20 - if (def->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && - def->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Controllers must use the 'ccid' address type")); - return NULL; - } - return g_steal_pointer(&def); } =20 --=20 2.26.2