[libvirt] [PATCH v3 6/8] conf: Check for duplicate authdef during hostdev iSCSI processing

John Ferlan posted 8 patches 6 years, 12 months ago
[libvirt] [PATCH v3 6/8] conf: Check for duplicate authdef during hostdev iSCSI processing
Posted by John Ferlan 6 years, 12 months ago
If virDomainHostdevSubsysSCSIiSCSIDefParseXML processing finds a
duplicated <auth> structure, we should error out rather than continue.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/conf/domain_conf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9e46cf721b..2d75849e3d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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 =
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 6/8] conf: Check for duplicate authdef during hostdev iSCSI processing
Posted by Ján Tomko 6 years, 12 months ago
On Tue, Feb 12, 2019 at 09:19:04AM -0500, John Ferlan wrote:
>If virDomainHostdevSubsysSCSIiSCSIDefParseXML processing finds a
>duplicated <auth> structure, we should error out rather than continue.
>
>Signed-off-by: John Ferlan <jferlan@redhat.com>
>---
> src/conf/domain_conf.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list