]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Check for duplicate authdef during hostdev iSCSI processing
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 13:35:38 +0000 (08:35 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 18:11:41 +0000 (13:11 -0500)
If virDomainHostdevSubsysSCSIiSCSIDefParseXML processing finds a
duplicated <auth> structure, we should error out rather than continue.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c

index 9e46cf721b436c79e4e73a315b5fc0489c95333a..2d75849e3db452df8e53b296595ab874d482ad56 100644 (file)
@@ -7616,6 +7616,12 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
     while (cur != NULL) {
         if (cur->type == XML_ELEMENT_NODE &&
             virXMLNodeNameEqual(cur, "auth")) {
+            if (iscsisrc->src->auth) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("an <auth> definition already found for "
+                                 "the <hostdev> iSCSI definition"));
+                return -1;
+            }
             if (!(authdef = virStorageAuthDefParse(cur, ctxt)))
                 return -1;
             if ((auth_secret_usage =