passwd: check_password: Use shadow entry for logs

Always use the name in shadow entry for logging. This reduces the
amount of data retrieved from password entry to bare minimum, i.e.
passing through into library call.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
This commit is contained in:
Tobias Stoeckmann 2025-12-16 10:03:43 +01:00 committed by Alejandro Colomar
parent 5719f1ec53
commit d37f63a2b3

View File

@ -436,8 +436,8 @@ static void check_password (const struct passwd *pw, const struct spwd *sp)
if (now < ok) {
(void) fprintf (stderr,
_("The password for %s cannot be changed yet.\n"),
pw->pw_name);
SYSLOG ((LOG_WARN, "now < minimum age for '%s'", pw->pw_name));
sp->sp_namp);
SYSLOG ((LOG_WARN, "now < minimum age for '%s'", sp->sp_namp));
closelog ();
exit (E_NOPERM);
}