From 6ea65c8992b2ef43f7ac5d62bbaebac16bee46e9 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Wed, 5 Mar 2008 00:10:25 +0000 Subject: [PATCH] Only reset the entries of existing users with faillog -r (not all numeric IDs starting from 0). Thanks to Peter Vrabec. --- ChangeLog | 6 ++++++ NEWS | 3 +++ src/faillog.c | 10 ++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d9a8a60..95ec9fd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-03-05 Nicolas François + + * NEWS, src/faillog.c: Only reset the entries of existing users + with faillog -r (not all numeric IDs starting from 0). Thanks to + Peter Vrabec. + 2008-03-05 Nicolas François * src/pwunconv.c: Fix typo. One "can't open" message is a "can't diff --git a/NEWS b/NEWS index a837bf38..fe68b978 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ shadow-4.1.0 -> shadow-4.1.1 UNRELEASED - chage * Fix bug which forbid to set the aging information of an account with a passwd entry, but no shadow entry. +- faillog + * faillog -r now only reset the entries of existing users. This makes + faillog faster. - gpasswd * Fix failures when the gshadow file is not present. * When a password is moved to the gshadow file, use "x" instead of "x" diff --git a/src/faillog.c b/src/faillog.c index 91aa768d..7ca935dd 100644 --- a/src/faillog.c +++ b/src/faillog.c @@ -163,8 +163,14 @@ static void reset (void) if (uflg) reset_one (user); - else - for (uid = 0; reset_one (uid); uid++); + else { + struct passwd *pwent; + + setpwent (); + while ( pwent = getpwent () ) { + reset_one (pwent->pw_uid); + } + } } static void print (void)