On 12/22/2015 08:32 PM, Isaac Dunham wrote:
On Tue, Dec 22, 2015 at 02:32:49PM +0100, Tito wrote:
On 12/18/2015 07:00 PM, Denys Vlasenko wrote:
On Fri, Dec 18, 2015 at 2:45 PM, Pascal Bach <[email protected]> wrote:
@@ -77,15 +79,14 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
free_me = NULL;
if (!(opt & OPT_ENC)) {
- char salt[sizeof("$N$XXXXXXXX")];
+ char salt[MAX_PW_SALT_LEN];
- crypt_make_salt(salt, 1);
if (opt & OPT_MD5) {
- salt[0] = '$';
- salt[1] = '1';
- salt[2] = '$';
- crypt_make_salt(salt + 3, 4);
+ /* Force MD5 if the -m flag is set */
+ algo = "md5";
}
+
+ crypt_make_pw_salt(salt, algo);
crypt_make_pw_salt() accepts lowercase algos, such as "md5".
chpasswd examples I googled use uppercase: "MD5".
So, this won't be compatible.
free_me = pass = pw_encrypt(pass, salt, 0);
}
Hi,
maybe we could change crypt_make_salt to accept lowercase and uppercase algo
arguments to keep compatibility with both ways
It looks to me like pw_encrypt(pass, str_tolower(salt), 0); would be
simpler and perhaps smaller.
Alternately, you could call that in crypt_make_salt() if you want to
make it consistent.
HTH,
Isaac Dunham
Hi,
Denys already fixed it in git, I should have checked it before writing.
Sorry for the noise.
Ciao,
Tito
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox