diff options
author | bapt <bapt@FreeBSD.org> | 2015-08-14 13:39:55 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-08-14 13:39:55 +0000 |
commit | d8c0f52c74f5f885ab8678e1478c88df17096401 (patch) | |
tree | 3ee051d0854edab4753aeaceeff2e6b8e766910a /usr.sbin/pw | |
parent | 2dd39755dda1946be1f28950c0dac2b2392cea20 (diff) | |
download | FreeBSD-src-d8c0f52c74f5f885ab8678e1478c88df17096401.zip FreeBSD-src-d8c0f52c74f5f885ab8678e1478c88df17096401.tar.gz |
Regression: fix pw usermod -w xxx
Reported by: gjb
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r-- | usr.sbin/pw/pw_user.c | 2 | ||||
-rwxr-xr-x | usr.sbin/pw/tests/pw_useradd.sh | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index d9bce87..5ccbd53 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -1645,6 +1645,8 @@ pw_user_mod(int argc, char **argv, char *arg1) if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); + cnf->default_password = boolean_val(passwd, + cnf->default_password); pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun); edited = true; } diff --git a/usr.sbin/pw/tests/pw_useradd.sh b/usr.sbin/pw/tests/pw_useradd.sh index 2ac31c9..f126bf0 100755 --- a/usr.sbin/pw/tests/pw_useradd.sh +++ b/usr.sbin/pw/tests/pw_useradd.sh @@ -314,6 +314,19 @@ user_add_already_exists_body() { ${PW} useradd foo } +atf_test_case user_add_w_yes +user_add_w_yes_body() { + populate_etc_skel + atf_check -s exit:0 ${PW} useradd foo -w yes + atf_check -s exit:0 \ + -o match:'^foo:\$.*' \ + grep "^foo" ${HOME}/master.passwd + atf_check -s exit:0 ${PW} usermod foo -w yes + atf_check -s exit:0 \ + -o match:'^foo:\$.*' \ + grep "^foo" ${HOME}/master.passwd +} + atf_init_test_cases() { atf_add_test_case user_add atf_add_test_case user_add_noupdate @@ -341,4 +354,5 @@ atf_init_test_cases() { atf_add_test_case user_add_uid_too_large atf_add_test_case user_add_bad_shell atf_add_test_case user_add_already_exists + atf_add_test_case user_add_w_yes } |