On Mon, 04.03.13 13:34, Nathaniel Chen ([email protected]) wrote: > this addresses the bug at: > https://bugs.freedesktop.org/show_bug.cgi?id=59311 > > hostnamectl is supposed to allow a range of special characters for > the 'pretty' hostname: > $ hostnamectl set-hostname --pretty "Nathaniels Desktop !@#$%" > ..however, it rejects apostrophes. > The manual for hostname suggests that this should be allowed. > > It makes sense to reject \0, \n, \\, etc...but since the function > string_is_safe() is used in multiple places, > pretty_string_is_safe() is the same, but without the apostrophe check.
Humm, I am not too happy with this. The function call pretty_string_is_safe() sounds way too generic for util.c. I mean, string_is_safe() already kinda is a bit too generic, but pretty_string_is_safe() makes it even worse, since it's really hard to determine from the name what it does. Moreover the pretty name is something that should take basically anything a user could sanely enter into an editbox in the UI. While \n and \0 are certainly not something the user could enter there \" and \\ are certainly something that are. As long as there's only one user, and one user only of this call I'd like to see this call stay in hostnamed.c. If there's really a second user of this, we can reconsider pretty_string_is_safe() in util.c (under a more precise name then, see above -- if the call is moved to hostnamed.c the current name is fine...) So: please move pretty_string_is_safe() to hostnamed.c and allow \" and \\, too! Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
