svn commit: trunk/busybox/loginutils

solar at busybox.net solar at busybox.net
Fri Apr 21 00:40:36 UTC 2006


Author: solar
Date: 2006-04-20 17:40:35 -0700 (Thu, 20 Apr 2006)
New Revision: 14930

Log:
- passwd doesnt use salt with md5 passwords; bug #604 thanks taviso

Modified:
   trunk/busybox/loginutils/passwd.c


Changeset:
Modified: trunk/busybox/loginutils/passwd.c
===================================================================
--- trunk/busybox/loginutils/passwd.c	2006-04-20 04:00:11 UTC (rev 14929)
+++ trunk/busybox/loginutils/passwd.c	2006-04-21 00:40:35 UTC (rev 14930)
@@ -322,6 +322,7 @@
 	char *clear;
 	char *cipher;
 	char *cp;
+	char salt[12]; /* "$N$XXXXXXXX" or "XX" */
 	char orig[200];
 	char pass[200];
 
@@ -376,11 +377,18 @@
 	}
 	memset(cp, 0, strlen(cp));
 	memset(orig, 0, sizeof(orig));
+	memset(salt, 0, sizeof(salt));
 
 	if (algo == 1) {
-		cp = pw_encrypt(pass, "$1$");
-	} else
-		cp = pw_encrypt(pass, crypt_make_salt());
+		strcpy(salt, "$1$");
+		strcat(salt, crypt_make_salt());
+		strcat(salt, crypt_make_salt());
+		strcat(salt, crypt_make_salt());
+	}
+
+	strcat(salt, crypt_make_salt());
+	cp = pw_encrypt(pass, salt);
+
 	memset(pass, 0, sizeof pass);
 	safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd));
 	return 0;




More information about the busybox-cvs mailing list