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 | |
| 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')
| -rw-r--r-- | loginutils/chpasswd.c | 5 | ||||
| -rw-r--r-- | loginutils/passwd.c | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index c2d86664d..6c4296faa 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c | |||
| @@ -67,7 +67,10 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) | |||
| 67 | * we try to find & change his passwd in /etc/passwd */ | 67 | * we try to find & change his passwd in /etc/passwd */ |
| 68 | #if ENABLE_FEATURE_SHADOWPASSWDS | 68 | #if ENABLE_FEATURE_SHADOWPASSWDS |
| 69 | rc = update_passwd(bb_path_shadow_file, name, pass, NULL); | 69 | rc = update_passwd(bb_path_shadow_file, name, pass, NULL); |
| 70 | if (rc == 0) /* no lines updated, no errors detected */ | 70 | if (rc > 0) /* password in /etc/shadow was updated */ |
| 71 | pass = (char*)"x"; | ||
| 72 | if (rc >= 0) | ||
| 73 | /* 0 = /etc/shadow missing (not an error), >0 = passwd changed in /etc/shadow */ | ||
| 71 | #endif | 74 | #endif |
| 72 | rc = update_passwd(bb_path_passwd_file, name, pass, NULL); | 75 | rc = update_passwd(bb_path_passwd_file, name, pass, NULL); |
| 73 | /* LOGMODE_BOTH logs to syslog also */ | 76 | /* LOGMODE_BOTH logs to syslog also */ |
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; |
