svn commit: branches/busybox_1_1_stable/loginutils

aldot at busybox.net aldot at busybox.net
Fri May 19 10:13:10 UTC 2006


Author: aldot
Date: 2006-05-19 03:13:09 -0700 (Fri, 19 May 2006)
New Revision: 15109

Log:
- passwd doesnt use salt with md5 passwords; bug #604 thanks taviso
  (r14930 from trunk)


Modified:
   branches/busybox_1_1_stable/loginutils/passwd.c


Changeset:
Modified: branches/busybox_1_1_stable/loginutils/passwd.c
===================================================================
--- branches/busybox_1_1_stable/loginutils/passwd.c	2006-05-18 21:53:51 UTC (rev 15108)
+++ branches/busybox_1_1_stable/loginutils/passwd.c	2006-05-19 10:13:09 UTC (rev 15109)
@@ -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