From 7585fa0fe910cba981850387e80e48b24f53fa38 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sun, 5 Apr 2009 21:23:17 +0000 Subject: [PATCH] * src/chage.c: When no shadow entry exist, thedefault sp_lstchg value should be -1 (no aging) rather than 0 (password must be changed). * src/chage.c: For password expiration and inactivity, indicate that the password must be changed when sp_lstchg is null rather than indicating that expiration and inactivity are not enabled. --- ChangeLog | 9 +++++++++ src/chage.c | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44930bed..ddffb795 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-04-04 Nicolas François + + * src/chage.c: When no shadow entry exist, thedefault sp_lstchg + value should be -1 (no aging) rather than 0 (password must be + changed). + * src/chage.c: For password expiration and inactivity, indicate + that the password must be changed when sp_lstchg is null rather + than indicating that expiration and inactivity are not enabled. + 2009-04-04 Nicolas François * libmisc/isexpired.c: Document the isexpired return value. diff --git a/src/chage.c b/src/chage.c index e7dad8b9..4579b80e 100644 --- a/src/chage.c +++ b/src/chage.c @@ -322,8 +322,11 @@ static void list_fields (void) * date plus the number of days the password is valid for. */ (void) fputs (_("Password expires\t\t\t\t\t: "), stdout); - if ((lastday <= 0) || (maxdays >= (10000 * (DAY / SCALE))) - || (maxdays < 0)) { + if (lastday == 0) { + (void) puts (_("password must be changed")); + } else if ( (lastday < 0) + || (maxdays >= (10000 * (DAY / SCALE))) + || (maxdays < 0)) { (void) puts (_("never")); } else { expires = changed + maxdays * SCALE; @@ -337,8 +340,12 @@ static void list_fields (void) * active will be disabled. */ (void) fputs (_("Password inactive\t\t\t\t\t: "), stdout); - if ((lastday <= 0) || (inactdays < 0) || - (maxdays >= (10000 * (DAY / SCALE))) || (maxdays < 0)) { + if (lastday == 0) { + (void) puts (_("password must be changed")); + } else if ( (lastday < 0) + || (inactdays < 0) + || (maxdays >= (10000 * (DAY / SCALE))) + || (maxdays < 0)) { (void) puts (_("never")); } else { expires = changed + (maxdays + inactdays) * SCALE; @@ -720,7 +727,7 @@ static void get_defaults (const struct spwd *sp) mindays = -1; } if (!dflg) { - lastday = 0; + lastday = -1; } if (!Wflg) { warndays = -1;