summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/pw_user.c
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2016-09-12 16:28:32 +0000
committerasomers <asomers@FreeBSD.org>2016-09-12 16:28:32 +0000
commita7a49e00771c003c9d25e5091aab43d1edd68afb (patch)
treead54f7cbd41daa08bae9e42660b0a952b92d31be /usr.sbin/pw/pw_user.c
parenta1a22a6289df77ce21f083b6b8f3334eaeba390e (diff)
downloadFreeBSD-src-a7a49e00771c003c9d25e5091aab43d1edd68afb.zip
FreeBSD-src-a7a49e00771c003c9d25e5091aab43d1edd68afb.tar.gz
MFC r302778
pw should sanitize the argument of -w. Otherwise, it will silently disable the login for the selected account if the argument is unrecognizable. usr.sbin/pw/pw.h usr.sbin/pw/pw_conf.c usr.sbin/pw/pw_user.c Use separate rules to validate boolean parameters and passwd parameters. Error out if a password parameter cannot be parsed. usr.sbin/pw/tests/Makefile usr.sbin/pw/tests/crypt.c usr.sbin/pw/tests/pw_useradd.sh usr.sbin/pw/tests/pw_usermod.sh Add tests for the validation. Also, enhance existing password-related tests to actually validate that the correct hash is written to master.passwd.
Diffstat (limited to 'usr.sbin/pw/pw_user.c')
-rw-r--r--usr.sbin/pw/pw_user.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index 67186c3..75e7fb6 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -1315,7 +1315,7 @@ pw_user_add(int argc, char **argv, char *arg1)
mix_config(cmdcnf, cnf);
if (default_passwd)
- cmdcnf->default_password = boolean_val(default_passwd,
+ cmdcnf->default_password = passwd_val(default_passwd,
cnf->default_password);
if (genconf) {
if (name != NULL)
@@ -1717,7 +1717,7 @@ 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 = passwd_val(passwd,
cnf->default_password);
pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun);
edited = true;
OpenPOWER on IntegriCloud