If (maxsize == -1), then ((size_t)maxsize == SIZE_MAX). And no size can ever be >= SIZE_MAX, so it will never return false if sysconf(3) reports an unlimited user-name size via returning -1. Well, to be pedantic, that disallows a user-name siz of precisely SIZE_MAX bytes when sysconf(3) returns -1. However, that's probably a good thing; such a long user name might trigger Undefined Behavior somewhere else, so be cautious and disallow it. I hope nobody will be using the entire address space for a user name. The commit that introduced that check missed that this code had always supported unlimited user-name sizes since it was introduced by Iker in3b7cc05387("lib: replace `USER_NAME_MAX_LENGTH` macro"), and6be85b0baf("lib/chkname.c: Use tmp variable to avoid a -Wsign-compare warning") even clarified this in the commit message. So, while the code in6a1f45d932("lib/chkname.c: Support unlimited user name lengths") wasn't bad per se, the commit message was incorrect. What that patch did was adding code for handling EINVAL (or any other errors that a future kernel might add). To be more pedantically correct, that commit also allowed (under certain circumstances, user names of SIZE_MAX bytes, but those were originally allowed (by accident), and only became disallowed in403a2e3771("lib/chkname.c: Take NUL byte into account"). But again, let's disallow those, just to be cautious. Link: <https://github.com/shadow-maint/shadow/pull/935> Link: <https://github.com/shadow-maint/shadow/pull/935#discussion_r1477429492> See-also:6be85b0baf("lib/chkname.c: Use tmp variable to avoid a -Wsign-compare warning") Fixes:6a1f45d932("lib/chkname.c: Support unlimited user name lengths") Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Cc: Tobias Stoeckmann <tobias@stoeckmann.org> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
shadow-utils
Introduction
The shadow-utils package includes the necessary programs for converting UNIX password files to the shadow password format, plus programs for managing user and group accounts. The pwconv command converts passwords to the shadow password format. The pwunconv command unconverts shadow passwords and generates a passwd file (a standard UNIX password file). The pwck command checks the integrity of password and shadow files. The lastlog command prints out the last login times for all users. The useradd, userdel, and usermod commands are used for managing user accounts. The groupadd, groupdel, and groupmod commands are used for managing group accounts.
Sites
Code
The main development branch is at https://github.com/shadow-maint/shadow.git
See STABLE.md for a list of supported stable branches.
Contacts
There are several ways to contact us:
- the general discussion mailing list
- the #shadow IRC channel on libera.chat:
- irc://irc.libera.chat/shadow
Mailing archives
- the general discussion mailing list archive
- the commit mailing list archive, only used for historical purposes
Contributions
Contributions are welcome. Follow the guidelines before posting any patches.
Authors and maintainers
Authors and maintainers are listed in AUTHORS.md.