[PATCH 3/3] conf: storage: pool: reject name containing '/'

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

 



Trying to define a pool name containing an embedded '/'
will immediately fail when trying to write the XML to disk.
This patch explicitly rejects names containing a '/'

Besides our stateful driver, there are two other storage impls:
esx and phyp. esx doesn't support pool creation, so this should
doesn't apply.

phyp does support pool creation, and the name is passed to the
'mksp' tool, which google doesn't reveal whether it accepts '/'
or not. IMO the likeliness of this impacting any users is near zero
---
 src/conf/storage_conf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index daf8f99..6fa9695 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -853,6 +853,12 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
         goto error;
     }
 
+    if (strchr(ret->name, '/')) {
+        virReportError(VIR_ERR_XML_ERROR,
+                       _("name %s cannot contain '/'"), ret->name);
+        goto error;
+    }
+
     uuid = virXPathString("string(./uuid)", ctxt);
     if (uuid == NULL) {
         if (virUUIDGenerate(ret->uuid) < 0) {
-- 
2.7.4

--
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]