summaryrefslogtreecommitdiffstats
path: root/pw/tests/pw_useradd.sh
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-08-02 12:47:50 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-08-02 12:47:50 +0000
commit0c4addea3407c6268cd01be51e8d56a804e5b15d (patch)
tree6a632c6d718df3fdad70db4b8a3569a58f595176 /pw/tests/pw_useradd.sh
parentf1bef959a51e2994216735586c6ef525f2728f10 (diff)
downloadpw-darwin-0c4addea3407c6268cd01be51e8d56a804e5b15d.tar.gz
pw-darwin-0c4addea3407c6268cd01be51e8d56a804e5b15d.tar.zst
pw-darwin-0c4addea3407c6268cd01be51e8d56a804e5b15d.zip
Rewrite parsing subcommands arguments of pw(8)
Now each subcommands checks its arguments in a dedicated functions. This helps improving input validation, code readability/maintainability While here: - Add a -y option to pw userdel/usermod so it can maintain NIS servers if nispasswd is not defined in pw.conf(5) - Allow pw -r <rootdir> to remove directory with userdel -r - Fix bug when renaming a user which was not renaming the user name it groups it is a member of. - Only parse pw.conf(5) when needed.
Diffstat (limited to 'pw/tests/pw_useradd.sh')
-rwxr-xr-xpw/tests/pw_useradd.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/pw/tests/pw_useradd.sh b/pw/tests/pw_useradd.sh
index 7306387..401769b 100755
--- a/pw/tests/pw_useradd.sh
+++ b/pw/tests/pw_useradd.sh
@@ -250,9 +250,9 @@ user_add_R_body() {
test -d ${HOME}/home/bar || atf_fail "Directory not created"
atf_check -s exit:0 ${RPW} userdel bar
test -d ${HOME}/home/bar || atf_fail "Directory removed"
-# atf_check -s exit:0 ${RPW} useradd bar
-# atf_check -s exit:0 ${RPW} userdel bar -r
-# test -d ${HOME}/home/bar && atf_fail "Directory not removed"
+ atf_check -s exit:0 ${RPW} useradd bar
+ atf_check -s exit:0 ${RPW} userdel bar -r
+ [ ! -d ${HOME}/home/bar ] || atf_fail "Directory not removed"
}
atf_test_case user_add_skel
@@ -296,6 +296,14 @@ user_add_uid_too_large_body() {
${PW} useradd -n test1 -u 9999999999999
}
+atf_test_case user_add_bad_shell
+user_add_bad_shell_body() {
+ populate_etc_skel
+
+ atf_check -s exit:0 ${PW} useradd foo -s sh
+ atf_check -s exit:78 -e ignore ${PW} useradd bar -s badshell
+}
+
atf_init_test_cases() {
atf_add_test_case user_add
atf_add_test_case user_add_noupdate
@@ -321,4 +329,5 @@ atf_init_test_cases() {
atf_add_test_case user_add_skel
atf_add_test_case user_add_uid0
atf_add_test_case user_add_uid_too_large
+ atf_add_test_case user_add_bad_shell
}