Skip to content

src/{chfn,chsh,passwd}.c: Allow bad names (regression fix)#1671

Open
alejandro-colomar wants to merge 4 commits into
shadow-maint:masterfrom
alejandro-colomar:reg_badname
Open

src/{chfn,chsh,passwd}.c: Allow bad names (regression fix)#1671
alejandro-colomar wants to merge 4 commits into
shadow-maint:masterfrom
alejandro-colomar:reg_badname

Conversation

@alejandro-colomar

@alejandro-colomar alejandro-colomar commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator
    These programs don't add new users.  Because they handle existing users,
    they should handle them with whatever names they already have, including
    bad names.
    
    A recent commit that added some username syntax validation blindly
    removed support for bad names in these programs.  Fix that regression.

Also, pass the badname flag as a function parameter instead of an extern variable. This makes it easier to analyze which programs allow badnames and which don't.

Also, remove an inconsistent (and seemingly accidental) allowance of badnames in group names in newusers(8).

Fixes: 326889c (2024-10-22; "Fix coverity unbound buffer issues")
Fixes: a2cd3e9 (2019-10-04; "chkname.c, pwck.c, useradd.c, usermod.c, newusers.c: Allow names that do not conform to standards")
Cc: @MarcinDigitic , @edneville

... instead of an extern variable.  This makes it easier to analyze
which programs allow badnames and which don't.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
These programs don't add new users.  Because they handle existing users,
they should handle them with whatever names they already have, including
bad names.

A recent commit that added some username syntax validation blindly
removed support for bad names in these programs.  Fix that regression.

Fixes: 326889c (2024-10-22; "Fix coverity unbound buffer issues")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Other programs handling groups don't allow this.
I believe this was only accidentally allowed.

Fixes: a2cd3e9 (2019-10-04; "chkname.c, pwck.c, useradd.c, usermod.c, newusers.c: Allow names that do not conform to standards")
Cc: ed <ed@s5h.net>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
We don't allow badnames in group names.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
@alejandro-colomar alejandro-colomar changed the title src/{chfn,chsh,passwd}.c: Allow bad names src/{chfn,chsh,passwd}.c: Allow bad names (regression fix) Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant