Fix /home symlink creation
Add regression test about it
This commit is contained in:
parent
243f5e3085
commit
729d9b2caa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286986
@ -123,7 +123,7 @@ mkdir_home_parents(int dfd, const char *dir)
|
||||
errx(EX_UNAVAILABLE, "out of memory");
|
||||
if (mkdirat(dfd, tmp, _DEF_DIRMODE) != -1 || errno == EEXIST) {
|
||||
fchownat(dfd, tmp, 0, 0, 0);
|
||||
symlinkat(tmp, dfd, dirs + 1);
|
||||
symlinkat(tmp, dfd, dirs);
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
@ -246,6 +246,7 @@ user_add_R_body() {
|
||||
|
||||
atf_check -s exit:0 ${RPW} useradd foo
|
||||
atf_check -s exit:0 ${RPW} useradd bar -m
|
||||
test -d ${HOME}/home || atf_fail "Home parent directory not created"
|
||||
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"
|
||||
@ -254,6 +255,17 @@ user_add_R_body() {
|
||||
[ ! -d ${HOME}/home/bar ] || atf_fail "Directory not removed"
|
||||
}
|
||||
|
||||
atf_test_case user_add_R_symlink
|
||||
user_add_R_symlink_body() {
|
||||
populate_root_etc_skel
|
||||
|
||||
mkdir ${HOME}/usr
|
||||
atf_check -s exit:0 ${RPW} useradd foo -m
|
||||
test -d ${HOME}/usr/home || atf_fail "Home parent directory not created"
|
||||
test -h ${HOME}/home || atf_fail "/home directory is not a symlink"
|
||||
atf_check -s exit:0 -o inline:"usr/home\n" readlink ${HOME}/home
|
||||
}
|
||||
|
||||
atf_test_case user_add_skel
|
||||
user_add_skel_body() {
|
||||
populate_root_etc_skel
|
||||
@ -348,6 +360,7 @@ atf_init_test_cases() {
|
||||
atf_add_test_case user_add_invalid_group_entry
|
||||
atf_add_test_case user_add_password_from_h
|
||||
atf_add_test_case user_add_R
|
||||
atf_add_test_case user_add_R_symlink
|
||||
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