components/samba/samba/patches/ace4-synchronize.patch
author Jiri Sasek <Jiri.Sasek@Sun.COM>
Fri, 16 Dec 2011 08:40:13 -0800
changeset 628 c3c0c8f3f696
parent 264 84a67a54e8fd
permissions -rw-r--r--
7119845 Samba 3.5.10 can not use the system kerberos keytab. 7121739 Reorganize Samba source patches to change-set manner.

7011577 Impossible to rename a file on a ZFS filesystem when installing 146364-01 (Samba 3.5.5)
Fix bug #7909 - map SYNCHRONIZE acl permission statically in zfs_acl vfs module.

diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 1913946..e2f9fe3 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -280,7 +280,9 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *theacl, /* in */
 		DEBUG(10, ("mapped ace flags: 0x%x => 0x%x\n",
 		      ace->aceFlags, mapped_ace_flags));
 
-		mask = ace->aceMask;
+		/* Windows clients expect SYNC on acls to
+		   correctly allow rename. See bug #7909. */
+		mask = ace->aceMask | SMB_ACE4_SYNCHRONIZE;
 		init_sec_ace(&nt_ace_list[good_aces++], &sid,
 			ace->aceType, mask,
 			mapped_ace_flags);
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index 98c9bcf..8a2c378 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -124,6 +124,9 @@ static bool zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
 		acebuf[i].a_type        = aceprop->aceType;
 		acebuf[i].a_flags       = aceprop->aceFlags;
 		acebuf[i].a_access_mask = aceprop->aceMask;
+		/* SYNC on acls is a no-op on ZFS.
+		   See bug #7909. */
+		acebuf[i].a_access_mask &= ~SMB_ACE4_SYNCHRONIZE;
 		acebuf[i].a_who         = aceprop->who.id;
 		if(aceprop->flags & SMB_ACE4_ID_SPECIAL) {
 			switch(aceprop->who.special_id) {