mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
pw: tests: add a test for -M with a pre-existing home directory
Previous versions of pw(8) wouldn't chmod the home directory if it already existed prior to user creation, rendering adduser(8) -M ineffective in some cases. Add a test to cover that situation. PR: 280099 Reviewed by: kevans
This commit is contained in:
parent
6a7238fd7c
commit
f7cf62cf72
@ -329,6 +329,21 @@ user_add_dir_body() {
|
||||
stat -f '%p' ${HOME}/home/foo
|
||||
}
|
||||
|
||||
atf_test_case user_add_existing_dir
|
||||
user_add_existing_dir_body() {
|
||||
populate_root_etc_skel
|
||||
|
||||
mkdir -p -m 0777 ${HOME}/home/foo
|
||||
atf_check -o inline:"40777\n" \
|
||||
stat -f '%p' ${HOME}/home/foo
|
||||
|
||||
atf_check -s exit:0 ${RPW} useradd foo -M 0705 -m
|
||||
atf_check grep -q '^foo:' $HOME/etc/master.passwd
|
||||
atf_check test -d ${HOME}/home/foo
|
||||
atf_check -o inline:"40705\n" \
|
||||
stat -f '%p' ${HOME}/home/foo
|
||||
}
|
||||
|
||||
atf_test_case user_add_skel
|
||||
user_add_skel_body() {
|
||||
populate_root_etc_skel
|
||||
@ -528,6 +543,7 @@ atf_init_test_cases() {
|
||||
atf_add_test_case user_add_R_no_symlink
|
||||
atf_add_test_case user_add_R_intermed
|
||||
atf_add_test_case user_add_dir
|
||||
atf_add_test_case user_add_existing_dir
|
||||
atf_add_test_case user_add_skel
|
||||
atf_add_test_case user_add_uid0
|
||||
atf_add_test_case user_add_uid_too_large
|
||||
|
Loading…
Reference in New Issue
Block a user