]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: avoid slash characters to the new domain name.
authorJulio Faracco <jcfaracco@gmail.com>
Tue, 1 May 2018 15:56:08 +0000 (12:56 -0300)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 3 May 2018 15:25:01 +0000 (11:25 -0400)
The 'domrename' command needs to check if the new domain name contains
the slash character. This character is not accepted by libvirt XML
definition because it is an invalid char (see Cole's commit b1fc6a7b7).
This commit enhace the 'domrename' command adding this check.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1333232

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_driver.c

index ef11e3cc449d4b2bdaa2ffc3838d2538c3cdff5a..9ce97eaa1d8ae0aeb236849b4e8b1e842030aa03 100644 (file)
@@ -20765,6 +20765,12 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
 
     virCheckFlags(0, ret);
 
+    if (strchr(new_name, '/')) {
+        virReportError(VIR_ERR_XML_ERROR,
+                       _("name %s cannot contain '/'"), new_name);
+        return -1;
+    }
+
     cfg = virQEMUDriverGetConfig(driver);
 
     if (VIR_STRDUP(new_dom_name, new_name) < 0)