]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Forbid snapshot names starting with '.'
authorPeter Krempa <pkrempa@redhat.com>
Mon, 21 Jan 2013 21:09:33 +0000 (22:09 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 22 Jan 2013 10:54:52 +0000 (11:54 +0100)
Forbid the names to match the loading procedure of snapshots.

src/qemu/qemu_driver.c

index 3a54228389fdd48eff17aa4969847a31f0254991..72907d212fb2da4e59780114010a5a8b19243467 100644 (file)
@@ -11347,14 +11347,24 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
                                                 parse_flags)))
         goto cleanup;
 
-    /* reject snapshot names containing slashes as snapshot definitions are
-     * saved in files containing the name */
-    if (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA) &&
-        strchr(def->name, '/')) {
-        virReportError(VIR_ERR_XML_DETAIL,
-                       _("invalid snapshot name '%s': name can't contain '/'"),
-                       def->name);
-        goto cleanup;
+    /* reject snapshot names containing slashes or starting with dot as
+     * snapshot definitions are saved in files named by the snapshot name */
+    if (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) {
+        if (strchr(def->name, '/')) {
+            virReportError(VIR_ERR_XML_DETAIL,
+                           _("invalid snapshot name '%s': "
+                             "name can't contain '/'"),
+                           def->name);
+            goto cleanup;
+        }
+
+        if (def->name[0] == '.') {
+            virReportError(VIR_ERR_XML_DETAIL,
+                           _("invalid snapshot name '%s': "
+                             "name can't start with '.'"),
+                           def->name);
+            goto cleanup;
+        }
     }
 
     /* reject the VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag where not supported */