From 2077ea849b052de272146a95015b12b36eaecbdd Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Fri, 10 Mar 2017 10:04:20 -0500 Subject: [PATCH] conf: Add missing validate for fchost search fields 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 --- 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 68def65bf9..6c701464bd 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -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 && -- 2.47.2