From: John Ferlan Date: Fri, 10 Mar 2017 15:04:20 +0000 (-0500) Subject: conf: Add missing validate for fchost search fields X-Git-Tag: v3.2.0-rc1~259 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2077ea849b052de272146a95015b12b36eaecbdd;p=thirdparty%2Flibvirt.git 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 --- 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 &&