diff options
author | Tito Ragusa <farmatito@tiscali.it> | 2011-04-05 00:18:33 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-04-05 00:18:33 +0200 |
commit | 9eb7bfd4d4ede3b6aa6a42595fd8824316ab4e2f (patch) | |
tree | 0904c7ccd33100ce863fc695bb05964b6407faed /loginutils/passwd.c | |
parent | 12140e607cad045a41aaeb2ea54d4d9938645f4a (diff) | |
download | busybox-w32-9eb7bfd4d4ede3b6aa6a42595fd8824316ab4e2f.tar.gz busybox-w32-9eb7bfd4d4ede3b6aa6a42595fd8824316ab4e2f.tar.bz2 busybox-w32-9eb7bfd4d4ede3b6aa6a42595fd8824316ab4e2f.zip |
passwd,chpasswd: reset password in /etc/passwd to "x" if /etc/shadow was updated
Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils/passwd.c')
-rw-r--r-- | loginutils/passwd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index 8b6a63eec..810644e61 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -184,8 +184,7 @@ int passwd_main(int argc UNUSED_PARAM, char **argv) | |||
184 | * strdup'ing to avoid nasty surprizes */ | 184 | * strdup'ing to avoid nasty surprizes */ |
185 | newp = xstrdup(&pw->pw_passwd[1]); | 185 | newp = xstrdup(&pw->pw_passwd[1]); |
186 | } else if (opt & OPT_delete) { | 186 | } else if (opt & OPT_delete) { |
187 | //newp = xstrdup(""); | 187 | newp = (char*)""; //xstrdup(""); |
188 | newp = (char*)""; | ||
189 | } | 188 | } |
190 | 189 | ||
191 | rlimit_fsize.rlim_cur = rlimit_fsize.rlim_max = 512L * 30000; | 190 | rlimit_fsize.rlim_cur = rlimit_fsize.rlim_max = 512L * 30000; |
@@ -201,7 +200,11 @@ int passwd_main(int argc UNUSED_PARAM, char **argv) | |||
201 | #if ENABLE_FEATURE_SHADOWPASSWDS | 200 | #if ENABLE_FEATURE_SHADOWPASSWDS |
202 | filename = bb_path_shadow_file; | 201 | filename = bb_path_shadow_file; |
203 | rc = update_passwd(bb_path_shadow_file, name, newp, NULL); | 202 | rc = update_passwd(bb_path_shadow_file, name, newp, NULL); |
204 | if (rc == 0) /* no lines updated, no errors detected */ | 203 | if (rc > 0) |
204 | /* password in /etc/shadow was updated */ | ||
205 | newp = (char*) "x"; //xstrdup("x"); | ||
206 | if (rc >= 0) | ||
207 | /* 0 = /etc/shadow missing (not an error), >0 = passwd changed in /etc/shadow */ | ||
205 | #endif | 208 | #endif |
206 | { | 209 | { |
207 | filename = bb_path_passwd_file; | 210 | filename = bb_path_passwd_file; |