Re: [PATCH] qemu: Forbid snapshot names starting with '.'

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

 



On 01/21/2013 10:10 PM, Peter Krempa wrote:
> Forbid the names to match the loading procedure of snapshots.
> ---
>  src/qemu/qemu_driver.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 3a54228..8286334 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -11348,13 +11348,23 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
>          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;
> +     * saved in files containing the name and names starting with dots */
> +    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 */
> 

I'd change the comment to something more readable, like "reject snapshot
names containing slashes or starting with dot as snapshot definitions
are saved in files containing the name" for example, but it's just a
comment, so ACK either way.

Martin

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]