summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch')
-rw-r--r--meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch83
1 files changed, 44 insertions, 39 deletions
diff --git a/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch b/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch
index 2f084b4e9b..7024136593 100644
--- a/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch
+++ b/meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch
@@ -1,17 +1,17 @@
1Upstream-Status: Inappropriate [OE specific] 1Subject: [PATCH] useradd.c: create parent directories when necessary
2 2
3Subject: useradd.c: create parent directories when necessary 3Upstream-Status: Inappropriate [OE specific]
4 4
5Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 5Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
6--- 6---
7 src/useradd.c | 72 +++++++++++++++++++++++++++++++++++++++------------------ 7 src/useradd.c | 82 +++++++++++++++++++++++++++++++++++++++--------------------
8 1 file changed, 49 insertions(+), 23 deletions(-) 8 1 file changed, 54 insertions(+), 28 deletions(-)
9 9
10diff --git a/src/useradd.c b/src/useradd.c 10diff --git a/src/useradd.c b/src/useradd.c
11index 4bd969d..cb5dd6c 100644 11index 7214e72..3aaf45c 100644
12--- a/src/useradd.c 12--- a/src/useradd.c
13+++ b/src/useradd.c 13+++ b/src/useradd.c
14@@ -1896,6 +1896,35 @@ static void usr_update (void) 14@@ -2021,6 +2021,35 @@ static void usr_update (void)
15 } 15 }
16 16
17 /* 17 /*
@@ -47,63 +47,68 @@ index 4bd969d..cb5dd6c 100644
47 * create_home - create the user's home directory 47 * create_home - create the user's home directory
48 * 48 *
49 * create_home() creates the user's home directory if it does not 49 * create_home() creates the user's home directory if it does not
50@@ -1910,39 +1939,36 @@ static void create_home (void) 50@@ -2038,42 +2067,39 @@ static void create_home (void)
51 fail_exit (E_HOMEDIR); 51 fail_exit (E_HOMEDIR);
52 } 52 }
53 #endif 53 #endif
54- /* XXX - create missing parent directories. --marekm */ 54- /* XXX - create missing parent directories. --marekm */
55- if (mkdir (user_home, 0) != 0) { 55- if (mkdir (prefix_user_home, 0) != 0) {
56- fprintf (stderr, 56- fprintf (stderr,
57- _("%s: cannot create directory %s\n"), 57- _("%s: cannot create directory %s\n"),
58- Prog, user_home); 58- Prog, prefix_user_home);
59-#ifdef WITH_AUDIT 59+ mkdir_p(user_home);
60+ }
61+ if (access (prefix_user_home, F_OK) != 0) {
62 #ifdef WITH_AUDIT
60- audit_logger (AUDIT_ADD_USER, Prog, 63- audit_logger (AUDIT_ADD_USER, Prog,
61- "adding home directory", 64- "adding home directory",
62- user_name, (unsigned int) user_id, 65- user_name, (unsigned int) user_id,
63- SHADOW_AUDIT_FAILURE); 66- SHADOW_AUDIT_FAILURE);
64-#endif 67+ audit_logger (AUDIT_ADD_USER, Prog,
65- fail_exit (E_HOMEDIR); 68+ "adding home directory",
66- } 69+ user_name, (unsigned int) user_id,
67- chown (user_home, user_id, user_gid); 70+ SHADOW_AUDIT_FAILURE);
68- chmod (user_home,
69- 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
70-#ifdef WITH_ATTR
71- attr_copy_file (def_template, user_home, NULL, NULL);
72-#endif
73- home_added = true;
74+ mkdir_p(user_home);
75+ }
76+ if (access (user_home, F_OK) != 0) {
77 #ifdef WITH_AUDIT
78 audit_logger (AUDIT_ADD_USER, Prog,
79 "adding home directory",
80 user_name, (unsigned int) user_id,
81- SHADOW_AUDIT_SUCCESS);
82+ SHADOW_AUDIT_FAILURE);
83 #endif 71 #endif
84-#ifdef WITH_SELINUX
85- /* Reset SELinux to create files with default contexts */
86- if (reset_selinux_file_context () != 0) {
87- fail_exit (E_HOMEDIR); 72- fail_exit (E_HOMEDIR);
88- } 73- }
74- (void) chown (prefix_user_home, user_id, user_gid);
75- chmod (prefix_user_home,
76- 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
89+ fail_exit (E_HOMEDIR); 77+ fail_exit (E_HOMEDIR);
90+ } 78+ }
91+ chown (user_home, user_id, user_gid); 79+ (void) chown (prefix_user_home, user_id, user_gid);
92+ chmod (user_home, 80+ chmod (prefix_user_home,
93+ 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK)); 81+ 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
94+#ifdef WITH_ATTR 82 #ifdef WITH_ATTR
83- attr_copy_file (def_template, user_home, NULL, NULL);
95+ attr_copy_file (def_template, user_home, NULL, NULL); 84+ attr_copy_file (def_template, user_home, NULL, NULL);
96+#endif 85 #endif
86- home_added = true;
97+ home_added = true; 87+ home_added = true;
98+#ifdef WITH_AUDIT 88 #ifdef WITH_AUDIT
89- audit_logger (AUDIT_ADD_USER, Prog,
90- "adding home directory",
91- user_name, (unsigned int) user_id,
92- SHADOW_AUDIT_SUCCESS);
99+ audit_logger (AUDIT_ADD_USER, Prog, 93+ audit_logger (AUDIT_ADD_USER, Prog,
100+ "adding home directory", 94+ "adding home directory",
101+ user_name, (unsigned int) user_id, 95+ user_name, (unsigned int) user_id,
102+ SHADOW_AUDIT_SUCCESS); 96+ SHADOW_AUDIT_SUCCESS);
103 #endif 97 #endif
104+#ifdef WITH_SELINUX 98 #ifdef WITH_SELINUX
99- /* Reset SELinux to create files with default contexts */
100- if (reset_selinux_file_context () != 0) {
101- fprintf (stderr,
102- _("%s: cannot reset SELinux file creation context\n"),
103- Prog);
104- fail_exit (E_HOMEDIR);
105- }
106-#endif
105+ /* Reset SELinux to create files with default contexts */ 107+ /* Reset SELinux to create files with default contexts */
106+ if (reset_selinux_file_context () != 0) { 108+ if (reset_selinux_file_context () != 0) {
109+ fprintf (stderr,
110+ _("%s: cannot reset SELinux file creation context\n"),
111+ Prog);
107+ fail_exit (E_HOMEDIR); 112+ fail_exit (E_HOMEDIR);
108 } 113 }
109+#endif 114+#endif
@@ -111,5 +116,5 @@ index 4bd969d..cb5dd6c 100644
111 116
112 /* 117 /*
113-- 118--
1141.7.9.5 1192.11.0
115 120