diff --git a/src/passwd.c b/src/passwd.c index ef7bee85..a24e62df 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -343,7 +343,6 @@ static int new_password (const struct passwd *pw) */ static void check_password (const struct passwd *pw, const struct spwd *sp) { - time_t now; int exp_status; exp_status = isexpired (pw, sp); @@ -363,8 +362,6 @@ static void check_password (const struct passwd *pw, const struct spwd *sp) return; } - (void) time (&now); - /* * Expired accounts cannot be changed ever. Passwords which are * locked may not be changed. Passwords where min > max may not be @@ -387,10 +384,11 @@ static void check_password (const struct passwd *pw, const struct spwd *sp) * Passwords may only be changed after sp_min time is up. */ if (sp->sp_lstchg > 0) { - time_t ok; - ok = (time_t) sp->sp_lstchg * DAY; + long now, ok; + now = time(NULL) / DAY; + ok = sp->sp_lstchg; if (sp->sp_min > 0) { - ok += (time_t) sp->sp_min * DAY; + ok += sp->sp_min; } if (now < ok) {