lib/limits.c: check_logins(): Report LOGIN_ERROR_LOGIN if str2ul() ERANGE

Fixes: 10396f9536 ("* libmisc/limits.c: Parse the limits, umask, nice, maxlogin, file limit with getlog() / getulong().")
Link: <882cf59459>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-01-11 11:47:50 +01:00
committed by Serge Hallyn
parent 568d26d7ed
commit c2ebd210e7

View File

@@ -118,6 +118,10 @@ static int check_logins (const char *name, const char *maxlogins)
unsigned long limit, count;
if (str2ul(&limit, maxlogins) == -1) {
if (errno == ERANGE) {
SYSLOG((LOG_WARN, "Invalid maxlogins value\n"));
return LOGIN_ERROR_LOGIN;
}
return 0;
}