]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: set only default acls to folders #9545 (#9599)
authorremueller <mueller.reinhold@web.de>
Mon, 16 Jul 2018 14:56:01 +0000 (16:56 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 16 Jul 2018 14:56:01 +0000 (16:56 +0200)
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

index 7489bf1e6f5e1b46886884f8b868e3dc8488b9e2..52f4d90fba1500b682edee624ef0a28314b4d7a3 100644 (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)