[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 4/4] qemu: Reject attempts to create snapshots with names containig '/'



On Thu, Jan 17, 2013 at 14:12:05 +0100, Peter Krempa wrote:
> The snapshot name is used to create path to the definition save file.
> When the name contains slashes the creation of the file fails. Reject
> such names.
> ---
>  src/qemu/qemu_driver.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index b264fc8..8aae803 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -11342,6 +11342,16 @@ 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 the VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag where not supported */
>      if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE &&
>          (!virDomainObjIsActive(vm) ||

ACK we want this one to make the situation in 3/4 less likely to happen.

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]