]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Add missing validate for fchost search fields
authorJohn Ferlan <jferlan@redhat.com>
Fri, 10 Mar 2017 15:04:20 +0000 (10:04 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 16 Mar 2017 01:17:47 +0000 (21:17 -0400)
Commit id 'bb74a7ffe' added some new fields to search for a fchost by
parent wwnn/wwpn or parent_fabric_name, but neglected to validate that
the data within the fields was valid at parse time. This could lead to
eventual failure at run time, so rather than have the failure then, let's
validate now.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/conf/storage_conf.c

index 68def65bf9e7a36f68a8f38fd442606f5d66635f..6c701464bdd63b22068045269c987db011ee89cd 100644 (file)
@@ -960,6 +960,18 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
                 goto error;
             }
 
+            if (ret->source.adapter.data.fchost.parent_wwnn &&
+                !virValidateWWN(ret->source.adapter.data.fchost.parent_wwnn))
+                goto error;
+
+            if (ret->source.adapter.data.fchost.parent_wwpn &&
+                !virValidateWWN(ret->source.adapter.data.fchost.parent_wwpn))
+                goto error;
+
+            if (ret->source.adapter.data.fchost.parent_fabric_wwn &&
+                !virValidateWWN(ret->source.adapter.data.fchost.parent_fabric_wwn))
+                goto error;
+
         } else if (ret->source.adapter.type ==
                    VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
             if (!ret->source.adapter.data.scsi_host.name &&