shadow-utils/shadow-4.8.1-useradd_create...

25 lines
987 B
Diff

diff -up shadow-4.8.1/src/useradd.c.useradd_create_relative_home_path_correctly shadow-4.8.1/src/useradd.c
--- shadow-4.8.1/src/useradd.c.useradd_create_relative_home_path_correctly 2021-06-28 16:10:23.928435372 +0200
+++ shadow-4.8.1/src/useradd.c 2021-06-28 16:11:30.784495046 +0200
@@ -2140,7 +2140,6 @@ static void create_home (void)
Prog, user_home);
fail_exit (E_HOMEDIR);
}
- ++bhome;
#ifdef WITH_SELINUX
if (set_selinux_file_context (prefix_user_home, NULL) != 0) {
@@ -2157,7 +2156,11 @@ static void create_home (void)
*/
cp = strtok (bhome, "/");
while (cp) {
- strcat (path, "/");
+ /* Avoid turning a relative path into an absolute path.
+ */
+ if (bhome[0] == '/' || strlen (path) != 0) {
+ strcat (path, "/");
+ }
strcat (path, cp);
if (access (path, F_OK) != 0) {
/* Check if parent directory is BTRFS, fail if requesting