Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103067114
D40085.id121930.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D40085.id121930.diff
View Options
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -112,36 +112,20 @@
}
tmp[0] = '\0';
- /*
- * This is a kludge especially for Joerg :)
- * If the home directory would be created in the root partition, then
- * we really create it under /usr which is likely to have more space.
- * But we create a symlink from cnf->home -> "/usr" -> cnf->home
- */
- if (strchr(dirs, '/') == NULL) {
- asprintf(&tmp, "usr/%s", dirs);
- if (tmp == NULL)
- 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);
- }
- free(tmp);
- }
tmp = dirs;
if (fstatat(dfd, dirs, &st, 0) == -1) {
while ((tmp = strchr(tmp + 1, '/')) != NULL) {
*tmp = '\0';
if (fstatat(dfd, dirs, &st, 0) == -1) {
if (mkdirat(dfd, dirs, _DEF_DIRMODE) == -1)
- err(EX_OSFILE, "'%s' (root home parent) is not a directory", dirs);
+ err(EX_OSFILE, "'%s' (home parent) is not a directory", dirs);
}
*tmp = '/';
}
}
if (fstatat(dfd, dirs, &st, 0) == -1) {
if (mkdirat(dfd, dirs, _DEF_DIRMODE) == -1)
- err(EX_OSFILE, "'%s' (root home parent) is not a directory", dirs);
+ err(EX_OSFILE, "'%s' (home parent) is not a directory", dirs);
fchownat(dfd, dirs, 0, 0, 0);
}
diff --git a/usr.sbin/pw/tests/pw_useradd_test.sh b/usr.sbin/pw/tests/pw_useradd_test.sh
--- a/usr.sbin/pw/tests/pw_useradd_test.sh
+++ b/usr.sbin/pw/tests/pw_useradd_test.sh
@@ -295,15 +295,23 @@
[ ! -d ${HOME}/home/bar ] || atf_fail "Directory not removed"
}
-atf_test_case user_add_R_symlink
-user_add_R_symlink_body() {
+atf_test_case user_add_R_no_symlink
+user_add_R_no_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
+ [ ! -d ${HOME}/usr/home ] || atf_fail "/usr/home created"
+ test -d ${HOME}/home || atf_fail "/home directory not created"
+}
+
+atf_test_case user_add_R_intermed
+user_add_R_intermed_body() {
+ populate_root_etc_skel
+
+ atf_check -s exit:0 ${RPW} useradd foo -m -d /a/b/c/foo
+ test -d ${HOME}/a/b/c || atf_fail "intermediate directories not created"
+ test -d ${HOME}/a/b/c/foo || atf_fail "user directory not created"
}
atf_test_case user_add_skel
@@ -479,7 +487,8 @@
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_R_no_symlink
+ atf_add_test_case user_add_R_intermed
atf_add_test_case user_add_skel
atf_add_test_case user_add_uid0
atf_add_test_case user_add_uid_too_large
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 12:14 PM (21 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14761184
Default Alt Text
D40085.id121930.diff (2 KB)
Attached To
Mode
D40085: pw: do not move /home/$user to /usr/home
Attached
Detach File
Event Timeline
Log In to Comment