]> xenbits.xensource.com Git - libvirt.git/commitdiff
networkValidate: Forbid new-line char in network name
authorSławek Kapłoński <slawek@kaplonski.pl>
Wed, 19 Oct 2016 20:57:48 +0000 (22:57 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 20 Oct 2016 11:10:42 +0000 (19:10 +0800)
New line character in name of network is now forbidden because it
mess virsh output and can be confusing for users.  Validation of
name is done in network driver, after parsing XML to avoid
problems with disappeared network which was already created with
new-line char in name.

Closes-Bug: https://bugzilla.redhat.com/show_bug.cgi?id=818064
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/network/bridge_driver.c

index b2af482725416d84e9881feae9ae65b16b1b56ab..9d7fc31f8f739bec024fe44d578ca561a02efd30 100644 (file)
@@ -2973,6 +2973,9 @@ networkValidate(virNetworkDriverStatePtr driver,
     bool bandwidthAllowed = true;
     bool usesInterface = false, usesAddress = false;
 
+    if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
+        return -1;
+
     /* Only the three L3 network types that are configured by libvirt
      * need to have a bridge device name / mac address provided
      */