From 0c4addea3407c6268cd01be51e8d56a804e5b15d Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sun, 2 Aug 2015 12:47:50 +0000 Subject: 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 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. --- pw/tests/pw_useradd.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'pw/tests/pw_useradd.sh') 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 } -- cgit v1.2.3-56-ge451