mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
qemu: Forbid snapshot names starting with '.'
Forbid the names to match the loading procedure of snapshots.
This commit is contained in:
parent
074b6d45b0
commit
f4ece17665
@ -11347,16 +11347,26 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
parse_flags)))
|
parse_flags)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* reject snapshot names containing slashes as snapshot definitions are
|
/* reject snapshot names containing slashes or starting with dot as
|
||||||
* saved in files containing the name */
|
* snapshot definitions are saved in files named by the snapshot name */
|
||||||
if (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA) &&
|
if (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) {
|
||||||
strchr(def->name, '/')) {
|
if (strchr(def->name, '/')) {
|
||||||
virReportError(VIR_ERR_XML_DETAIL,
|
virReportError(VIR_ERR_XML_DETAIL,
|
||||||
_("invalid snapshot name '%s': name can't contain '/'"),
|
_("invalid snapshot name '%s': "
|
||||||
|
"name can't contain '/'"),
|
||||||
def->name);
|
def->name);
|
||||||
goto cleanup;
|
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 */
|
/* reject the VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag where not supported */
|
||||||
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE &&
|
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE &&
|
||||||
(!virDomainObjIsActive(vm) ||
|
(!virDomainObjIsActive(vm) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user