From c1a37b4f31d5252ce074d41f69e526aa84b0d3b3 Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Thu, 24 Sep 2020 16:04:12 -0400 Subject: [PATCH] vfs_zfsacl: only grant DELETE_CHILD if ACL tag is special When ZFS aclmode is set to "passthrough" chmod(2)/fchmod(2) will result in special entries being modified in a way such that delete, delete_child, write_named_attr, write_attribute are stripped from the returned ACL entry, and the kernel / ZFS treats this as having rights equivalent to the desired POSIX mode. Historically, samba has added delete_child to the NFSv4 ACL, but this is only really called for in the case of special entries in this particular circumstance. Alter circumstances in which delete_child is granted so that it only is added to special entries. This preserves the intend post-chmod behavior, but avoids unnecessarily increasing permissions in cases where it's not intended. Further modification of this behavior may be required so that we grant a general read or general write permissions set in case of POSIX read / POSIX write on special entries. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14471 Signed-off-by: Andrew Walker Reviewed-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/modules/vfs_zfsacl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 17478ad116e..093eb5111e1 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -112,7 +112,10 @@ static NTSTATUS zfs_get_nt_acl_common(struct connection_struct *conn, special = acebuf[i].a_flags & (ACE_OWNER|ACE_GROUP|ACE_EVERYONE); - if (is_dir && (aceprop.aceMask & SMB_ACE4_ADD_FILE)) { + if (is_dir && + (aceprop.aceMask & SMB_ACE4_ADD_FILE) && + (special != 0)) + { aceprop.aceMask |= SMB_ACE4_DELETE_CHILD; } -- 2.47.3