OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --- a/loginutils/chpasswd.c |
2 | +++ b/loginutils/chpasswd.c |
||
3 | @@ -97,6 +97,11 @@ int chpasswd_main(int argc UNUSED_PARAM, |
||
4 | |||
5 | crypt_make_pw_salt(salt, algo); |
||
6 | free_me = pass = pw_encrypt(pass, salt, 0); |
||
7 | + |
||
8 | + if (pass[0] == 0) { |
||
9 | + free(free_me); |
||
10 | + bb_perror_msg_and_die("password encryption failed"); |
||
11 | + } |
||
12 | } |
||
13 | |||
14 | /* This is rather complex: if user is not found in /etc/shadow, |
||
15 | --- a/loginutils/cryptpw.c |
||
16 | +++ b/loginutils/cryptpw.c |
||
17 | @@ -95,7 +95,7 @@ int cryptpw_main(int argc UNUSED_PARAM, |
||
18 | /* Supports: cryptpw -m sha256 PASS 'rounds=999999999$SALT' */ |
||
19 | char salt[MAX_PW_SALT_LEN + sizeof("rounds=999999999$")]; |
||
20 | char *salt_ptr; |
||
21 | - char *password; |
||
22 | + char *password, *hash; |
||
23 | const char *opt_m, *opt_S; |
||
24 | int fd; |
||
25 | |||
26 | @@ -140,8 +140,12 @@ int cryptpw_main(int argc UNUSED_PARAM, |
||
27 | /* may still be NULL on EOF/error */ |
||
28 | } |
||
29 | |||
30 | - if (password) |
||
31 | - puts(pw_encrypt(password, salt, 1)); |
||
32 | + if (password) { |
||
33 | + hash = pw_encrypt(password, salt, 1); |
||
34 | + if (hash[0] == 0) |
||
35 | + bb_perror_msg_and_die("password encryption failed"); |
||
36 | + puts(hash); |
||
37 | + } |
||
38 | |||
39 | return EXIT_SUCCESS; |
||
40 | } |
||
41 | --- a/loginutils/passwd.c |
||
42 | +++ b/loginutils/passwd.c |
||
43 | @@ -187,6 +187,10 @@ int passwd_main(int argc UNUSED_PARAM, c |
||
44 | if (!newp) { |
||
45 | logmode = LOGMODE_STDIO; |
||
46 | bb_error_msg_and_die("password for %s is unchanged", name); |
||
47 | + } else if (newp[0] == 0) { |
||
48 | + logmode = LOGMODE_STDIO; |
||
49 | + free(newp); |
||
50 | + bb_perror_msg_and_die("password encryption failed"); |
||
51 | } |
||
52 | } else if (opt & OPT_lock) { |
||
53 | if (!c) |