blob: 474b3a257ee4512967781d304ebfefc38650efdd [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001Subject: [PATCH] useradd: copy extended attributes of home
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002
3The Home directory wasn't getting the extended attributes
4of /etc/skel. This patch fixes that issue and adds the copy
5of the extended attributes of the root of the home directory.
6
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08007Upstream-Status: Pending
Brad Bishop6e60e8b2018-02-01 10:27:11 -05008
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011---
12 src/useradd.c | 6 ++++++
13 1 file changed, 6 insertions(+)
14
15diff --git a/src/useradd.c b/src/useradd.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016index e721e52..c74e491 100644
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017--- a/src/useradd.c
18+++ b/src/useradd.c
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019@@ -54,6 +54,9 @@
20 #include <sys/wait.h>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021 #include <time.h>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022 #include <unistd.h>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023+#ifdef WITH_ATTR
24+#include <attr/libattr.h>
25+#endif
26 #include "chkname.h"
27 #include "defines.h"
28 #include "faillog.h"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080029@@ -2042,6 +2045,9 @@ static void create_home (void)
30 (void) chown (prefix_user_home, user_id, user_gid);
31 chmod (prefix_user_home,
Brad Bishop6e60e8b2018-02-01 10:27:11 -050032 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
33+#ifdef WITH_ATTR
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034+ attr_copy_file (def_template, user_home, NULL, NULL);
Brad Bishop6e60e8b2018-02-01 10:27:11 -050035+#endif
36 home_added = true;
37 #ifdef WITH_AUDIT
38 audit_logger (AUDIT_ADD_USER, Prog,
39--
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800402.11.0
Brad Bishop6e60e8b2018-02-01 10:27:11 -050041