0001-useradd-copy-extended-attributes-of-home.patch 1.1 KB

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