895dfd77d2
time_t isn't necessarily unsigned (in fact, it's likely to be signed. Therefore, parse the number as the right type, via a2i(time_t, ...). Still, reject negative numbers, just to be cautious. It was done before (strtoull_noneg()), so it shouldn't be a problem. (However, strtoull_noneg() was only introduced recently, and before that we called strtoull(3), which silently accepted negative values.) Remove the limitation of ULONG_MAX, which seems arbitrary. It probably was written in times where 'time_t' had the same length of 'long', and this was thus a test that the value didn't overflow 'time_t'. Such a test is implicit in the a2i() call, so forget about it. Unify the error messages into a single one that provides all the info (except the value of 'fallback'). Link: <https://github.com/shadow-maint/shadow/commit/cb610d54b47ea2fc3da5a1b7c5a71274ada91371#r136407772> Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Cc: Chris Lamb <lamby@debian.org> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
1.1 KiB
1.1 KiB