[libvirt] [PATCH 2/2] Forbid new-line char in name of new storagepool

Sławek Kapłoński slawek at kaplonski.pl
Fri Nov 11 09:17:38 UTC 2016


New line character in name of storagepool is now forbidden because it
mess virsh output and can be confusing for users.
Validation of name is done in driver, after parsing XML to avoid
problems with dissappeared pools which was already created with
new-line char in name.
---
 src/storage/storage_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 4f990f4..9900596 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -780,6 +780,9 @@ storagePoolDefineXML(virConnectPtr conn,
     if (!(def = virStoragePoolDefParseString(xml)))
         goto cleanup;
 
+    if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
+        goto cleanup;
+
     if (virStoragePoolDefineXMLEnsureACL(conn, def) < 0)
         goto cleanup;
 
-- 
2.7.4




More information about the libvir-list mailing list