From 2667385b0e7a39eaf1d09bc16b45c237e11b4644 Mon Sep 17 00:00:00 2001 From: remueller Date: Mon, 16 Jul 2018 16:56:01 +0200 Subject: [PATCH] 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 --- src/tmpfiles/tmpfiles.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 7489bf1e6f..52f4d90fba 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -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)