core: drop suid/sgid bit of files/dirs when doing recursive chown
This adds some extra paranoia: when we recursively chown a directory for use with DynamicUser=1 services we'll now drop suid/sgid from all files we chown(). Of course, such files should not exist in the first place, and noone should get access to those dirs who isn't root anyway, but let's better be safe than sorry, and drop everything we come across.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
25e68fd397
commit
607b358ef2
@@ -106,7 +106,7 @@ static void test_chown_recursive(void) {
|
||||
assert_se(st.st_gid == gid);
|
||||
assert_se(has_xattr(p));
|
||||
|
||||
assert_se(path_chown_recursive(t, 1, 2) >= 0);
|
||||
assert_se(path_chown_recursive(t, 1, 2, 07777) >= 0);
|
||||
|
||||
p = strjoina(t, "/dir");
|
||||
assert_se(lstat(p, &st) >= 0);
|
||||
|
||||
Reference in New Issue
Block a user