-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/chkname.c: Put limits for LOGIN_NAME_MAX and sysconf(_SC_LOGIN_NAME_MAX) #1169
Conversation
@zeha , I put a Co-developed-by because I based my patch on your Debian patch. However, if you think it differs too much from it and want that tag removed, just let me know. If you want to keep it, feel free to sign the patch by sending a Signed-off-by. |
4db388c
to
1d87e94
Compare
Yeah I don't think I want to take any credit for this. BTW: do you want a comment next to the ifdef hinting that this is mostly for Hurd? |
1d87e94
to
f269895
Compare
Okay. I've removed that line, and put a Cc one instead.
I don't know. I tend to prefer to keep those in the commit message. A git-blame(1) on any of those three lines will bring up this commit. I've edited the commit message to be more explicit about it. |
@zeha , @sthibaul , @stoeckmann Can you please review and (if appropriate) approve the PR? |
Thanks for the reviews! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for taking care of it.
…nd sysconf(_SC_LOGIN_NAME_MAX) GNU Hurd doesn't define LOGIN_NAME_MAX. GNU Hurd recommends having no system limits. When a program needs a limit, because it needs to validate user input, it is recommended that each program defines its own limit macros. The rationale is that this avoids hard-coded limits in ABIs, which cannot be modified ever. However, that doesn't mean that programs should have no limits at all. We use this limit for validating user input, and so we shouldn't allow anything just because the system doesn't want to set a limit. So, when sysconf(2) returns -1, either due to an error or due to a claim for no limits, we must fall back to the LOGIN_NAME_MAX value. And if the system doesn't define that value, we must define it ourselves (we're more or less free to choose any value, so let's pick the one that glibc provides nowadays). Fixes: 6a1f45d (2024-02-04; "lib/chkname.c: Support unlimited user name lengths") Closes: <shadow-maint#1166> Cc: Chris Hofstaedtler <[email protected]> Reviewed-by: Samuel Thibault <[email protected]> Reviewed-by: Tobias Stoeckmann <[email protected]> Reviewed-by: Iker Pedrosa <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
f269895
to
87b8f5a
Compare
Fixes: 6a1f45d (2024-02-04: "lib/chkname.c: Support unlimited user name lengths")
Closes: #1166
Cc: @zeha
Cc: @stoeckmann
Cc: @sthibaul
Revisions:
v1b
v1c