[PATCH v3 02/18] conf: Add missing validate for fchost search fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/conf/storage_conf.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index e4d89dd..8e3b175 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -952,6 +952,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 &&
-- 
2.9.3

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux