summaryrefslogtreecommitdiffstats
path: root/pw/tests
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-07-13 09:09:09 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-07-13 09:09:09 +0000
commit7254577fd79afd8749c6c009ae29792e91067b57 (patch)
treec19e3abe1ffb4ac098d41a2b10af44d50f34dfdc /pw/tests
parentf432528892063de5931f69643db9812cea58304e (diff)
downloadpw-darwin-7254577fd79afd8749c6c009ae29792e91067b57.tar.gz
pw-darwin-7254577fd79afd8749c6c009ae29792e91067b57.tar.zst
pw-darwin-7254577fd79afd8749c6c009ae29792e91067b57.zip
Add regression tests to ensure we keep allowing creating users with uid0
Diffstat (limited to 'pw/tests')
-rwxr-xr-xpw/tests/pw_useradd.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/pw/tests/pw_useradd.sh b/pw/tests/pw_useradd.sh
index 6c71af6..880dab5 100755
--- a/pw/tests/pw_useradd.sh
+++ b/pw/tests/pw_useradd.sh
@@ -279,6 +279,16 @@ user_add_skel_body() {
atf_check -o file:${HOME}/skel/c/d/dot.c -s exit:0 cat ${HOME}/home/foo/c/d/.c
}
+atf_test_case user_add_uid0
+user_add_uid0_body() {
+ populate_etc_skel
+ atf_check -e inline:"pw: WARNING: new account \`foo' has a uid of 0 (superuser access!)\n" \
+ -s exit:0 ${PW} useradd foo -u 0 -g 0 -d /root -s /bin/sh -c "Bourne-again Superuser" -o
+ atf_check \
+ -o inline:"foo:*:0:0::0:0:Bourne-again Superuser:/root:/bin/sh\n" \
+ -s exit:0 ${PW} usershow foo
+}
+
atf_init_test_cases() {
atf_add_test_case user_add
atf_add_test_case user_add_noupdate
@@ -302,4 +312,5 @@ atf_init_test_cases() {
atf_add_test_case user_add_password_from_h
atf_add_test_case user_add_R
atf_add_test_case user_add_skel
+ atf_add_test_case user_add_uid0
}