]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
passwd: check_password: Use shadow entry for logs
authorTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 16 Dec 2025 09:03:43 +0000 (10:03 +0100)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Tue, 16 Dec 2025 14:10:24 +0000 (15:10 +0100)
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>
src/passwd.c

index 961dd0f00bdfac0e89fa6bc0df8de15962221b6e..9c0349f39dd05ee814f18906e979dba238546a0a 100644 (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);
                }