1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-09 01:18:00 +03:00

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-09-23 15:11:59 +02:00
parent f093022155
commit 82b959ad02

View File

@ -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 <domain>"));
if (!(xml = virXMLParse(NULL, xmlStr, _("(domain_definition)"),
"domain", &ctxt, NULL, false))) {
return -1;
}