svn commit: trunk/busybox/libbb

vda at busybox.net vda at busybox.net
Tue Jul 3 10:28:47 UTC 2007


Author: vda
Date: 2007-07-03 03:28:46 -0700 (Tue, 03 Jul 2007)
New Revision: 18997

Log:
correct_password: if password is 'x' or '*' and there is no shadow, use
fake encrypted password 'aa' (which is guaranteed to fail password check).



Modified:
   trunk/busybox/libbb/correct_password.c


Changeset:
Modified: trunk/busybox/libbb/correct_password.c
===================================================================
--- trunk/busybox/libbb/correct_password.c	2007-07-03 08:26:24 UTC (rev 18996)
+++ trunk/busybox/libbb/correct_password.c	2007-07-03 10:28:46 UTC (rev 18997)
@@ -54,13 +54,11 @@
 		struct spwd spw;
 		struct spwd *result;
 		char buffer[256];
-		if (getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result) == 0)
-			correct = spw.sp_pwdp;
-		/* else: no valid shadow password, checking ordinary one */
+		correct = (getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result)) ? "aa" : spw.sp_pwdp;
 	}
 #endif
 
-	if (!correct || correct[0] == '\0')
+	if (!correct[0]) /* empty password field? */
 		return 1;
 
  fake_it:




More information about the busybox-cvs mailing list