From 39858da23037b377604c2770c659505a12f90e30 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Mon, 13 Mar 2017 10:57:23 +0100 Subject: shadow: 'useradd' copies root's extended attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The copy of extended attributes is interesting for Smack systems because it allows to set the security template of the user's home directories without modifying the tools (useradd here). But the version of useradd that copies the extended attributes doesn't copy the extended attributes of the root. This can make use of homes impossible! This patch corrects the issue by copying the extended attributes of the root directory: /home/user will get the extended attributes of /etc/skel. The patch is submitted upstream (see http://lists.alioth.debian.org/pipermail/pkg-shadow-commits/2017-March/003804.html) The existing patch specific to open-embedded is updated: 0001-useradd.c-create-parent-directories-when-necessary.patch Also, attr are activated for native tools. This is needed when users are created during image creation. (From OE-Core rev: eed66e85af5ca6bbdd80cc3d5cf8453e8d8880bc) Signed-off-by: José Bollo Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- ...01-useradd.c-create-parent-directories-when-necessary.patch | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'meta/recipes-extended/shadow/files/0001-useradd.c-create-parent-directories-when-necessary.patch') 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 85dde8e1bb..2f084b4e9b 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 @@ -11,7 +11,7 @@ diff --git a/src/useradd.c b/src/useradd.c index 4bd969d..cb5dd6c 100644 --- a/src/useradd.c +++ b/src/useradd.c -@@ -1893,6 +1893,35 @@ static void usr_update (void) +@@ -1896,6 +1896,35 @@ static void usr_update (void) } /* @@ -47,7 +47,7 @@ index 4bd969d..cb5dd6c 100644 * create_home - create the user's home directory * * create_home() creates the user's home directory if it does not -@@ -1907,36 +1936,33 @@ static void create_home (void) +@@ -1910,39 +1939,36 @@ static void create_home (void) fail_exit (E_HOMEDIR); } #endif @@ -67,6 +67,9 @@ index 4bd969d..cb5dd6c 100644 - chown (user_home, user_id, user_gid); - chmod (user_home, - 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK)); +-#ifdef WITH_ATTR +- attr_copy_file (def_template, user_home, NULL, NULL); +-#endif - home_added = true; + mkdir_p(user_home); + } @@ -88,6 +91,9 @@ index 4bd969d..cb5dd6c 100644 + chown (user_home, user_id, user_gid); + chmod (user_home, + 0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK)); ++#ifdef WITH_ATTR ++ attr_copy_file (def_template, user_home, NULL, NULL); ++#endif + home_added = true; +#ifdef WITH_AUDIT + audit_logger (AUDIT_ADD_USER, Prog, -- cgit v1.2.3-54-g00ecf