From: Peter Krempa Date: Fri, 23 Sep 2022 13:11:59 +0000 (+0200) Subject: security: aa-helper: Use virXMLParse instead of virXMLParseString X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=82b959ad02d4fdc0a89e15b104e91b63b99f9314;p=libvirt.git security: aa-helper: Use virXMLParse instead of virXMLParseString Use the helper with more features to validate the root XML element name instead of open-coding it. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index ceadaef99b..a15971b9bb 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -573,13 +573,8 @@ caps_mockup(vahControl * ctl, const char *xmlStr) g_autoptr(xmlXPathContext) ctxt = NULL; char *arch; - if (!(xml = virXMLParseStringCtxt(xmlStr, _("(domain_definition)"), - &ctxt))) { - return -1; - } - - if (!virXMLNodeNameEqual(ctxt->node, "domain")) { - vah_error(NULL, 0, _("unexpected root element, expecting ")); + if (!(xml = virXMLParse(NULL, xmlStr, _("(domain_definition)"), + "domain", &ctxt, NULL, false))) { return -1; }