lib: replace USER_NAME_MAX_LENGTH macro

Replace it by `sysconf(_SC_LOGIN_NAME_MAX)`, which is the maximum
username length supported by the kernel.

Resolves: https://github.com/shadow-maint/shadow/issues/674

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This commit is contained in:
Iker Pedrosa
2023-07-19 12:05:09 +02:00
committed by Serge Hallyn
parent fb8f44d73f
commit 3b7cc05387
3 changed files with 10 additions and 13 deletions
+2 -3
View File
@@ -75,10 +75,9 @@ static bool is_valid_name (const char *name)
bool is_valid_user_name (const char *name)
{
/*
* User names are limited by whatever utmp can
* handle.
* User names length are limited by the kernel
*/
if (strlen (name) > USER_NAME_MAX_LENGTH) {
if (strlen (name) > sysconf(_SC_LOGIN_NAME_MAX)) {
return false;
}