Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Aug 2015 13:39:55 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r286775 - in head/usr.sbin/pw: . tests
Message-ID:  <201508141339.t7EDdtZu054886@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Fri Aug 14 13:39:55 2015
New Revision: 286775
URL: https://svnweb.freebsd.org/changeset/base/286775

Log:
  Regression: fix pw usermod -w xxx
  
  Reported by:	gjb

Modified:
  head/usr.sbin/pw/pw_user.c
  head/usr.sbin/pw/tests/pw_useradd.sh

Modified: head/usr.sbin/pw/pw_user.c
==============================================================================
--- head/usr.sbin/pw/pw_user.c	Fri Aug 14 13:10:30 2015	(r286774)
+++ head/usr.sbin/pw/pw_user.c	Fri Aug 14 13:39:55 2015	(r286775)
@@ -1645,6 +1645,8 @@ pw_user_mod(int argc, char **argv, char 
 		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;
 	}

Modified: head/usr.sbin/pw/tests/pw_useradd.sh
==============================================================================
--- head/usr.sbin/pw/tests/pw_useradd.sh	Fri Aug 14 13:10:30 2015	(r286774)
+++ head/usr.sbin/pw/tests/pw_useradd.sh	Fri Aug 14 13:39:55 2015	(r286775)
@@ -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
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508141339.t7EDdtZu054886>