On 04/10/2014 10:02 PM, Jincheng Miao wrote: > If volume name is a path, storageVolCreateXML appends that name to > the specified pool path, that will taint other pools. Adding the > volume check is better for sanity. > > Signed-off-by: Jincheng Miao <[email protected]> > --- > src/storage/storage_driver.c | 9 +++++++++ > 1 file changed, 9 insertions(+) >
>
> + /* Make sure the volume name is not a path */
> + if (last_component(newvol->name) != newvol->name) {
Why not just:
if (strchr(newvol->name, '/'))
Also, shouldn't we forbid things like "." and ".." as the newvol name?
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("storage volume name '%s' is a path"),
I don't like the word "path" in a user-facing error message for anything
other than a list of directory names separated by colon; better would be
a message such as "requested storage volume name '%s' cannot contain /"
or "requested storage volume name '%s' not permitted".
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
