summaryrefslogtreecommitdiffstats
path: root/pw/tests
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-06-07 20:59:59 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-06-07 20:59:59 +0000
commit223ef3394cf724477520e801c506e253c3223c7d (patch)
tree7c707837725b612c96300d61d6d56cadccccc204 /pw/tests
parentd1593426badd25926a46d772133118bc1d3aab7b (diff)
downloadpw-darwin-223ef3394cf724477520e801c506e253c3223c7d.tar.gz
pw-darwin-223ef3394cf724477520e801c506e253c3223c7d.tar.zst
pw-darwin-223ef3394cf724477520e801c506e253c3223c7d.zip
Fix setting uid/gid min/max via pw
Diffstat (limited to 'pw/tests')
-rw-r--r--pw/tests/Makefile3
-rw-r--r--pw/tests/pw-modified.conf62
-rwxr-xr-xpw/tests/pw_config.sh10
3 files changed, 74 insertions, 1 deletions
diff --git a/pw/tests/Makefile b/pw/tests/Makefile
index 09fe93c..193b8ab 100644
--- a/pw/tests/Makefile
+++ b/pw/tests/Makefile
@@ -19,7 +19,8 @@ ATF_TESTS_SH= pw_etcdir \
TEST_METADATA.${tp}+= required_user="root"
.endfor
-FILES= group helper_functions.shin master.passwd pw.conf
+FILES= group helper_functions.shin master.passwd pw.conf \
+ pw-modified.conf
FILESDIR= ${TESTSDIR}
ATF_TESTS_SH+= pw_test
diff --git a/pw/tests/pw-modified.conf b/pw/tests/pw-modified.conf
new file mode 100644
index 0000000..84f44e7
--- /dev/null
+++ b/pw/tests/pw-modified.conf
@@ -0,0 +1,62 @@
+#
+# pw.conf - user/group configuration defaults
+#
+
+# Password for new users? no=nologin yes=loginid none=blank random=random
+defaultpasswd = "no"
+
+# Reuse gaps in uid sequence? (yes or no)
+reuseuids = "no"
+
+# Reuse gaps in gid sequence? (yes or no)
+reusegids = "no"
+
+# Path to the NIS passwd file (blank or 'no' for none)
+nispasswd =
+
+# Obtain default dotfiles from this directory
+skeleton = "/usr/share/skel"
+
+# Mail this file to new user (/etc/newuser.msg or no)
+newmail = "no"
+
+# Log add/change/remove information in this file
+logfile = "/var/log/userlog"
+
+# Root directory in which $HOME directory is created
+home = "/home"
+
+# Mode for the new $HOME directory, will be modified by umask
+homemode = 0777
+
+# Colon separated list of directories containing valid shells
+shellpath = "/bin"
+
+# Comma separated list of available shells (without paths)
+shells = "sh","csh","tcsh"
+
+# Default shell (without path)
+defaultshell = "sh"
+
+# Default group (leave blank for new group per user)
+defaultgroup = ""
+
+# Extra groups for new users
+extragroups =
+
+# Default login class for new users
+defaultclass = ""
+
+# Range of valid default user ids
+minuid = 2000
+maxuid = 5000
+
+# Range of valid default group ids
+mingid = 2100
+maxgid = 6000
+
+# Days after which account expires (0=disabled)
+expire_days = 0
+
+# Days after which password expires (0=disabled)
+password_days = 0
diff --git a/pw/tests/pw_config.sh b/pw/tests/pw_config.sh
index b5a4fad..fb6489a 100755
--- a/pw/tests/pw_config.sh
+++ b/pw/tests/pw_config.sh
@@ -11,6 +11,16 @@ generate_config_body() {
cat ${HOME}/foo.conf
}
+atf_test_case modify_config_uid_gid_boundaries
+modify_config_uid_gid_boundaries_body() {
+ atf_check -s exit:0 \
+ ${PW} useradd -D -C ${HOME}/foo.conf \
+ -u 2000,5000 -i 2100,6000
+ atf_check -o file:$(atf_get_srcdir)/pw-modified.conf \
+ cat ${HOME}/foo.conf
+}
+
atf_init_test_cases() {
atf_add_test_case generate_config
+ atf_add_test_case modify_config_uid_gid_boundaries
}