faillog faster reset

Peter Vrabec <[email protected]> Mon, 09 Jan 2006 13:31:49 -0500
Newsgroups gmane.linux.pld.shadow.general
Message-ID <[email protected]>
Hi,

this patch cause faillog to reset failures only for existing users, 
which should be much less than 64-bit of them (on 64-bit systems).
Idea from Chris Snook <[email protected]>
shadow-4.0.14-faillogReset.patch (text/x-patch, 399 B)
--- shadow-4.0.14/src/faillog.c.reset	2006-01-09 12:59:16.000000000 -0500
+++ shadow-4.0.14/src/faillog.c	2006-01-09 13:08:07.000000000 -0500
@@ -163,8 +163,13 @@
 
 	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)