mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
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>
This commit is contained in:
parent
12140e607c
commit
9eb7bfd4d4
@ -67,7 +67,10 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
* we try to find & change his passwd in /etc/passwd */
|
* we try to find & change his passwd in /etc/passwd */
|
||||||
#if ENABLE_FEATURE_SHADOWPASSWDS
|
#if ENABLE_FEATURE_SHADOWPASSWDS
|
||||||
rc = update_passwd(bb_path_shadow_file, name, pass, NULL);
|
rc = update_passwd(bb_path_shadow_file, name, pass, NULL);
|
||||||
if (rc == 0) /* no lines updated, no errors detected */
|
if (rc > 0) /* password in /etc/shadow was updated */
|
||||||
|
pass = (char*)"x";
|
||||||
|
if (rc >= 0)
|
||||||
|
/* 0 = /etc/shadow missing (not an error), >0 = passwd changed in /etc/shadow */
|
||||||
#endif
|
#endif
|
||||||
rc = update_passwd(bb_path_passwd_file, name, pass, NULL);
|
rc = update_passwd(bb_path_passwd_file, name, pass, NULL);
|
||||||
/* LOGMODE_BOTH logs to syslog also */
|
/* LOGMODE_BOTH logs to syslog also */
|
||||||
|
@ -184,8 +184,7 @@ int passwd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
* strdup'ing to avoid nasty surprizes */
|
* strdup'ing to avoid nasty surprizes */
|
||||||
newp = xstrdup(&pw->pw_passwd[1]);
|
newp = xstrdup(&pw->pw_passwd[1]);
|
||||||
} else if (opt & OPT_delete) {
|
} else if (opt & OPT_delete) {
|
||||||
//newp = xstrdup("");
|
newp = (char*)""; //xstrdup("");
|
||||||
newp = (char*)"";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rlimit_fsize.rlim_cur = rlimit_fsize.rlim_max = 512L * 30000;
|
rlimit_fsize.rlim_cur = rlimit_fsize.rlim_max = 512L * 30000;
|
||||||
@ -201,7 +200,11 @@ int passwd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
#if ENABLE_FEATURE_SHADOWPASSWDS
|
#if ENABLE_FEATURE_SHADOWPASSWDS
|
||||||
filename = bb_path_shadow_file;
|
filename = bb_path_shadow_file;
|
||||||
rc = update_passwd(bb_path_shadow_file, name, newp, NULL);
|
rc = update_passwd(bb_path_shadow_file, name, newp, NULL);
|
||||||
if (rc == 0) /* no lines updated, no errors detected */
|
if (rc > 0)
|
||||||
|
/* password in /etc/shadow was updated */
|
||||||
|
newp = (char*) "x"; //xstrdup("x");
|
||||||
|
if (rc >= 0)
|
||||||
|
/* 0 = /etc/shadow missing (not an error), >0 = passwd changed in /etc/shadow */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
filename = bb_path_passwd_file;
|
filename = bb_path_passwd_file;
|
||||||
|
Loading…
Reference in New Issue
Block a user