Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | Subject: [PATCH] useradd: copy extended attributes of home |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | |
| 3 | The Home directory wasn't getting the extended attributes |
| 4 | of /etc/skel. This patch fixes that issue and adds the copy |
| 5 | of the extended attributes of the root of the home directory. |
| 6 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 7 | Upstream-Status: Pending |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 8 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | Signed-off-by: José Bollo <jose.bollo@iot.bzh> |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 10 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | --- |
| 12 | src/useradd.c | 6 ++++++ |
| 13 | 1 file changed, 6 insertions(+) |
| 14 | |
| 15 | diff --git a/src/useradd.c b/src/useradd.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | index e721e52..c74e491 100644 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 17 | --- a/src/useradd.c |
| 18 | +++ b/src/useradd.c |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 19 | @@ -54,6 +54,9 @@ |
| 20 | #include <sys/wait.h> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 21 | #include <time.h> |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 22 | #include <unistd.h> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 23 | +#ifdef WITH_ATTR |
| 24 | +#include <attr/libattr.h> |
| 25 | +#endif |
| 26 | #include "chkname.h" |
| 27 | #include "defines.h" |
| 28 | #include "faillog.h" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 29 | @@ -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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 32 | 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK)); |
| 33 | +#ifdef WITH_ATTR |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 34 | + attr_copy_file (def_template, user_home, NULL, NULL); |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 35 | +#endif |
| 36 | home_added = true; |
| 37 | #ifdef WITH_AUDIT |
| 38 | audit_logger (AUDIT_ADD_USER, Prog, |
| 39 | -- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 40 | 2.11.0 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 41 | |