lib/chkname.c, src/: Strictly disallow the baddest names - #1406
Conversation
|
This list of characters should be regression-free, I think. I'll leave the remaining ones for a separate PR, for after the release. |
ikerexxe
left a comment
There was a problem hiding this comment.
Can you update the documentation? It'd be nice to align the man page documents with the existing behaviour
The manual pages are still compatible with this change. They just say: Which is still true. We just allow less names with --badname after this change, but that text is still valid. |
|
You're absolutely right. My apologies, I was mistakenly focused on the specific character set mentioned in the CAVEATS section of the |
ikerexxe
left a comment
There was a problem hiding this comment.
LGTM, but let's see what other people want to say before merging
|
LGTM, thanks. |
1d2c5ea to
e3d8353
Compare
|
I'm going to add |
e3d8353 to
2663084
Compare
|
Thanks! @hallyn , do you feel comfortable with this patch? |
Some names are bad, and some names are really bad. '--badname' should only allow the mildly bad ones, which we can handle. Some names are too bad, and it's not possible to deal with them. Reject them unconditionally. - A leading '-' is too dangerous. It breaks things like execve(2), and almost every command. - Spaces are used for delimiting lists of users and groups. - '"' is special in many languages, including the shell. Having it in user names would be unnecessarily dangerous. - '#' is used for delimiting comments in several of our config files. Having it in usernames could result in incorrect configuration files. - "'" is special in many languages, including the shell. Having it in user names would be unnecessarily dangerous. - ',' is used for delimiting lists of users and groups. - '/' is used for delimiting files, and thus could result in incorrect handling of users and groups. - ':' is the main delimiter in /etc/shadow and /etc/passwd. - ';' is special in many languages, including the shell. Having it in user names would be unnecessarily dangerous. There are other characters that we should disallow, but they need more research to make sure we don't introduce regressions. This set should be less problematic. Acked-by: Tobias Stoeckmann <tobias@stoeckmann.org> Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Reviewed-by: Chris Hofstaedtler <zeha@debian.org> Cc: Marc 'Zugschlus' Haber <mh+githubvisible@zugschlus.de> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2663084 to
defdaa9
Compare
|
Thanks. |
|
This seems like a poor decision to me since you can just edit I hope you do not consider further characters. I have been considering adding tests to GNU coreutils which break implementations that assume UTF-8 encoding. For example, having |
Most of these characters either already failed in some cases (for example,
I'll investigate the source code, in case there are other characters that would result in shadow misbehaving already, such as possibly
We don't have in mind anything about UTF8. We're concerned about |
[...]
I see. That sounds reasonable. I think my idea of "future characters" was a bit more dramatic than yours. :) Thanks for the quick response. |
Acked-by: @zeha
Acked-by: @stoeckmann
Cc: @Zugschlus
Cc: @ikerexxe
Cc: @hallyn
Revisions:
v1b
v2
'.v2b