On Sun, Oct 03, 2010 at 11:51:12PM +1100, Justin Clift wrote: > On 10/03/2010 08:33 PM, Richard W.M. Jones wrote: > <snip> > >Indeed. I'm sure we need a whitelist, not a blacklist as suggested by > >the other comment. All domains I'd ever want to create would match > >the regexp > > > >^[[:alpha:]][-_[:alnum:]]*$ > > > >This might break existing users however. > > Wonder if there are characters supported by some hypervisors, but not > others? I remember we had troubles with Xen, a long time ago, yes So unfortunately this is really hypervsor specific... Maybe we could have a generic checking routine but only providing a warning when the name isn't a simple name the XML way. One of the problem of the checking too is that most of the hypervisor APIs don't say a word about encoding, so you're not manipulating characters but 0 terminated byte strings. From there even your simple regexp goes havoc because what is an alphanumeric character, requires character analysis and you need the encoding for this. At least at libvirt API things are rather clear, in XML data there is no ambiguity possible, and outside we expect strings to be UTF-8. Actually I think that for ESX since all exchanges with the hypervisor are XML based there isn't that ambiguity about encoding at least. > ie maybe Xen supports '/', '*', '+' in guest names, but ESX doesn't > > That could lead to some interesting guest import problems. :( goes beyond that, someone using any non-ascii name will hit hypervisor specific behaviour, ISO-Latin, asian language ... and we habe no control over this except for some checking and the possibility of a warning. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list