tmpfiles: set only default acls to folders #9545 (#9599)

Check if the fd is a folder before setting default acls

Tested:

Ubuntu 18.04.

test.conf: A+ /tmp/test - - - - u:user2:rw,d:u:user1:rwx

The folder /tmp/test looks like

    /tmp/test/file1
    /tmp/test/folder2

start systemd-tmpfiles manually

Fixes: #9545
This commit is contained in:
remueller 2018-07-16 16:56:01 +02:00 committed by Lennart Poettering
parent 460d7ac3a2
commit 2667385b0e
1 changed files with 2 additions and 1 deletions

View File

@ -1035,7 +1035,8 @@ static int fd_set_acls(Item *item, int fd, const struct stat *st) {
if (item->acl_access)
r = path_set_acl(procfs_path, path, ACL_TYPE_ACCESS, item->acl_access, item->force);
if (r == 0 && item->acl_default)
/* set only default acls to folders */
if (r == 0 && item->acl_default && S_ISDIR(st->st_mode))
r = path_set_acl(procfs_path, path, ACL_TYPE_DEFAULT, item->acl_default, item->force);
if (r > 0)