From nobody Fri May 16 00:59:18 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1502713989760360.4586873161395; Mon, 14 Aug 2017 05:33:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AFCE36626C; Mon, 14 Aug 2017 12:33:07 +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 83AB61823F; Mon, 14 Aug 2017 12:33: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 3613C14B20; Mon, 14 Aug 2017 12:33:07 +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 v7ECWttX015550 for ; Mon, 14 Aug 2017 08:32:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 57F4568735; Mon, 14 Aug 2017 12:32:55 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id D452E6872B for ; Mon, 14 Aug 2017 12:32:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AFCE36626C Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 14 Aug 2017 14:32:43 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] =?utf-8?q?=5BPATCH_4/8=5D_conf=3A=C2=A0use_virXMLPropSt?= =?utf-8?q?ring_for_KeyWrapCipherDef_parsing?= 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 14 Aug 2017 12:33:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" XPath is good for random search of elements, not for accessing attributes of one node. Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 528d11c17d..9dc788e9f9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -933,7 +933,6 @@ virDomainXMLOptionClassDispose(void *obj) * * @def Domain definition * @node An XML cipher node - * @ctxt The XML context * * Parse the attributes from the cipher node and store the state * attribute in @def. @@ -947,8 +946,7 @@ virDomainXMLOptionClassDispose(void *obj) */ static int virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDefPtr keywrap, - xmlNodePtr node, - xmlXPathContextPtr ctxt) + xmlNodePtr node) { =20 char *name =3D NULL; @@ -956,10 +954,8 @@ virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDefP= tr keywrap, int state_type; int name_type; int ret =3D -1; - xmlNodePtr oldnode =3D ctxt->node; =20 - ctxt->node =3D node; - if (!(name =3D virXPathString("string(./@name)", ctxt))) { + if (!(name =3D virXMLPropString(node, "name"))) { virReportError(VIR_ERR_CONF_SYNTAX, "%s", _("missing name for cipher")); goto cleanup; @@ -971,7 +967,7 @@ virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDefPt= r keywrap, goto cleanup; } =20 - if (!(state =3D virXPathString("string(./@state)", ctxt))) { + if (!(state =3D virXMLPropString(node, "state"))) { virReportError(VIR_ERR_CONF_SYNTAX, _("missing state for cipher named %s"), name); goto cleanup; @@ -1017,7 +1013,6 @@ virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDef= Ptr keywrap, cleanup: VIR_FREE(name); VIR_FREE(state); - ctxt->node =3D oldnode; return ret; } =20 @@ -1036,7 +1031,7 @@ virDomainKeyWrapDefParseXML(virDomainDefPtr def, xmlX= PathContextPtr ctxt) goto cleanup; =20 for (i =3D 0; i < n; i++) { - if (virDomainKeyWrapCipherDefParseXML(def->keywrap, nodes[i], ctxt= ) < 0) + if (virDomainKeyWrapCipherDefParseXML(def->keywrap, nodes[i]) < 0) goto cleanup; } =20 --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list