faillog faster reset

Peter Vrabec <[email protected]> Tue, 3 Oct 2006 13:48:32 +0200
Newsgroups gmane.linux.pld.shadow.general
Message-ID <[email protected]>
--MP_gE5w012iAgTrbbW806DyoQz
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi Tomasz, 

it seems you forgot to commit attached patch.

see:
http://mail.pld.org.pl/mailman/pipermail/shadow/2006-January/000252.html
--MP_gE5w012iAgTrbbW806DyoQz
Content-Type: text/x-patch; name=shadow-faster-faillog.patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=shadow-faster-faillog.patch

--- shadow-4.0.3/src/faillog.c	2002-01-05 15:41:43.000000000 +0000
+++ shadow-4.0.3.bak/src/faillog.c	2006-01-06 10:43:19.000000000 +0000
@@ -248,8 +248,14 @@ static void reset (void)
 
 	if (uflg)
 		reset_one (user);
-	else
-		for (uid = 0; reset_one (uid); uid++);
+	else {
+		struct passwd *pwent;
+		int ret = 1;
+
+		setpwent ();
+		while ((pwent = getpwent ()) && ret == 1)
+				reset_one (pwent->pw_uid);
+	}
 }
 
 static int reset_one (uid_t uid)

--MP_gE5w012iAgTrbbW806DyoQz
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline