+ access = (sys_acl_get_perm(permset, SMB_ACL_READ) ? 4 : 0)
+ | (sys_acl_get_perm(permset, SMB_ACL_WRITE) ? 2 : 0)
++ | (sys_acl_get_perm(permset, SMB_ACL_DELETE) ? 8 : 0)
++ | (sys_acl_get_perm(permset, SMB_ACL_CHMOD) ? 16 : 0)
++ | (sys_acl_get_perm(permset, SMB_ACL_CHOWN) ? 32 : 0)
+ | (sys_acl_get_perm(permset, SMB_ACL_EXECUTE) ? 1 : 0);
+ /* continue == done with entry; break == store in temporary ida list */
+ switch (tag_type) {
+@@ -375,6 +378,12 @@ static int store_access_in_entry(uchar a
+
+ COE( sys_acl_get_permset,(entry, &permset) );
+ COE( sys_acl_clear_perms,(permset) );
++ if (access & 32)
++ COE( sys_acl_add_perm(permset, SMB_ACL_CHOWN) );
++ if (access & 16)
++ COE( sys_acl_add_perm(permset, SMB_ACL_CHMOD) );
++ if (access & 8)
++ COE( sys_acl_add_perm(permset, SMB_ACL_DELETE) );
+ if (access & 4)
+ COE( sys_acl_add_perm,(permset, SMB_ACL_READ) );
+ if (access & 2)
+@@ -408,7 +417,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
+
+ COE( sys_acl_create_entry,(smb_acl, &entry) );
+ COE( sys_acl_set_tag_type,(entry, SMB_ACL_USER_OBJ) );
+- COE2( store_access_in_entry,(racl->user_obj & 7, entry) );
++ COE2( store_access_in_entry,(racl->user_obj & 077, entry) );
+
+ for (ida = racl->users.idas, count = racl->users.count; count--; ida++) {
+ COE( sys_acl_create_entry,(smb_acl, &entry) );
+@@ -419,7 +428,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
+
+ COE( sys_acl_create_entry,(smb_acl, &entry) );
+ COE( sys_acl_set_tag_type,(entry, SMB_ACL_GROUP_OBJ) );
+- COE2( store_access_in_entry,(racl->group_obj & 7, entry) );
++ COE2( store_access_in_entry,(racl->group_obj & 077, entry) );
+
+ for (ida = racl->groups.idas, count = racl->groups.count; count--; ida++) {
+ COE( sys_acl_create_entry,(smb_acl, &entry) );
+@@ -429,7 +438,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
+ }
+
+ #ifdef ACLS_NEED_MASK
+- mask_bits = racl->mask == NO_ENTRY ? racl->group_obj & 7 : racl->mask;
++ mask_bits = racl->mask == NO_ENTRY ? racl->group_obj & 077 : racl->mask;
+ COE( sys_acl_create_entry,(smb_acl, &entry) );
+ COE( sys_acl_set_tag_type,(entry, SMB_ACL_MASK) );
+ COE2( store_access_in_entry,(mask_bits, entry) );
+@@ -443,7 +452,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
+
+ COE( sys_acl_create_entry,(smb_acl, &entry) );
+ COE( sys_acl_set_tag_type,(entry, SMB_ACL_OTHER) );
+- COE2( store_access_in_entry,(racl->other & 7, entry) );
++ COE2( store_access_in_entry,(racl->other & 077, entry) );
+
+ #ifdef DEBUG
+ if (sys_acl_valid(*smb_acl) < 0)
+@@ -646,7 +655,7 @@ static void receive_rsync_acl(rsync_acl
+ while (count--) {
+ char tag = read_byte(f);
+ uchar access = read_byte(f);
+- if (access & ~ (4 | 2 | 1)) {
++ if (access & ~(32 | 16 | 8 | 4 | 2 | 1)) {