From: Tobias Stoeckmann Date: Mon, 15 Dec 2025 09:45:41 +0000 (+0100) Subject: lib/pwd2spwd.c: Set no aging information X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f59cb5ab347e122e685f95e08298f0a8cd3301a;p=thirdparty%2Fshadow.git lib/pwd2spwd.c: Set no aging information The pwd_to_spwd routine claims that fields without corresponding information in the password file are set to uninitialized values, but sets some aging information. These cannot be available in struct passwd. Also, the code is only used in passwd to temporarily hold the new password. All other values are copied from an existing entry later on. If no entry exists, all values are dismissed anyway. Clarify that everything is uninitialized except name and password. Gets rid of magic value 10000 for sp_max. Signed-off-by: Tobias Stoeckmann --- diff --git a/lib/pwd2spwd.c b/lib/pwd2spwd.c index fceb4d86b..ea1bf064b 100644 --- a/lib/pwd2spwd.c +++ b/lib/pwd2spwd.c @@ -12,7 +12,6 @@ #ident "$Id$" #include -#include "prototypes.h" #include "defines.h" #include @@ -34,22 +33,13 @@ struct spwd *pwd_to_spwd (const struct passwd *pw) sp.sp_namp = pw->pw_name; sp.sp_pwdp = pw->pw_passwd; - /* - * Defaults used if there is no pw_age information. - */ - sp.sp_min = 0; - sp.sp_max = 10000; - sp.sp_lstchg = gettime () / DAY; - if (0 == sp.sp_lstchg) { - /* Better disable aging than requiring a password - * change */ - sp.sp_lstchg = -1; - } - /* * These fields have no corresponding information in the password * file. They are set to uninitialized values. */ + sp.sp_lstchg = -1; + sp.sp_min = 0; + sp.sp_max = -1; sp.sp_warn = -1; sp.sp_expire = -1; sp.sp_inact = -1;