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: <https://github.com/shadow-maint/shadow/pull/893/commits/882cf59459bc4501b0882a7f02d36c8ce28a30f2>
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
+4
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;
}