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

Sławek Kapłoński slawek at kaplonski.pl
Mon Oct 10 20:15:40 UTC 2016


New line character in name of network is now forbidden because it
mess virsh output and can be confusing for users.

Closes-Bug: https://bugzilla.redhat.com/show_bug.cgi?id=818064
---
 src/conf/network_conf.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index aa39776..a7f802b 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2117,11 +2117,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
         goto error;
     }
 
-    if (strchr(def->name, '/')) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("name %s cannot contain '/'"), def->name);
+    if (virXMLCheckString("name", def->name, "/\n"))
         goto error;
-    }
 
     /* Extract network uuid */
     tmp = virXPathString("string(./uuid[1])", ctxt);
-- 
2.10.0




More information about the libvir-list mailing list