Currently the home directory permissions are set by taking the /etc/skel mode and masking it with HOME_MODE:
override_umask = 0777 & ~get_umask(&configured_umask, "HOME_MODE"); stat(skel, &sb); /* performed by nftw() */ oddjob_selinux_mkdir(newpath, sb->st_mode & ~override_umask, uid, gid);
The problem is that when HOME_MODE is more permissive than /etc/skel, the masking will not produce the desired result, e.g.
skel_mode = 0755 HOME_MODE = 0775 override_umask = 0777 & ~HOME_MODE /* 0002 */ mode = skel_mode & ~override_umask /* 0755 & 0775 = 0755 */
In order to fix the problem, always use 0777 & ~override_umask for the top home directory.
Signed-off-by: Carlos Santos casantos@redhat.com Fixes: https://pagure.io/oddjob/issue/17
thanks, @casantos. I am currently on vacation due to school holidays and will look at this next week.
Metadata Update from @abbra: - Request assigned
LGTM. Thank you for the elaborate description.
Pull-Request has been merged by abbra
Currently the home directory permissions are set by taking the /etc/skel
mode and masking it with HOME_MODE:
The problem is that when HOME_MODE is more permissive than /etc/skel,
the masking will not produce the desired result, e.g.
In order to fix the problem, always use 0777 & ~override_umask for the
top home directory.
Signed-off-by: Carlos Santos casantos@redhat.com
Fixes: https://pagure.io/oddjob/issue/17