← Commit list

791976490

Ned Ludd
Ned Ludd
2006-04-21
SOURCE BUG Duration: 30s

Subject

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

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

loginutils/passwd.c+11 -3
@@ -322,6 +322,7 @@ static int new_password(const struct passwd *pw, int amroot, int algo)
char *clear;
char *cipher;
char *cp;
+ char salt[12]; /* "$N$XXXXXXXX" or "XX" */
char orig[200];
char pass[200];
@@ -376,11 +377,18 @@ static int new_password(const struct passwd *pw, int amroot, int algo)
}
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;