1 To use this patch, run these commands for a successful build:
3 patch -p1 <patches/acls.diff
4 patch -p1 <patches/adaptec_acl_mods.diff
6 ./configure --enable-acl-support
10 > Attached is a small patch which is meant to be applied to a copy of
11 > rsync which has already been patched with acl support (the acls.diff
12 > file in the patches folder). It allows the preservation of the delete,
13 > chmod, and chown bits which Adaptec has added to XFS on their SnapOS NAS
14 > units. This is nice for backing up files between different NAS units
15 > and preserving all of the Samba ACLs.
17 > I'm not sure how useful this patch will be because I'm not sure if any
18 > other NAS vendors have standardized on their extensions to POSIX ACLs to
19 > support Samba in the same manner that Adaptec has. FWIW, though, this
20 > will allow you to preserve acls when copying between different Adaptec
21 > based NAS units running SnapOS.
23 I (Wayne) tweaked the patch for style and to avoid using SMB_* constants
24 with literal values were needed.
26 I've also updated it to apply to the updated version of the acls.diff,
27 though I don't know if there might be some bits lost in the current
28 algorithm when using the file's mode bits to reconstruct a stripped ACL
33 @@ -282,6 +282,9 @@ static BOOL unpack_smb_acl(rsync_acl *ra
35 access = (sys_acl_get_perm(permset, SMB_ACL_READ) ? 4 : 0)
36 | (sys_acl_get_perm(permset, SMB_ACL_WRITE) ? 2 : 0)
37 + | (sys_acl_get_perm(permset, SMB_ACL_DELETE) ? 8 : 0)
38 + | (sys_acl_get_perm(permset, SMB_ACL_CHMOD) ? 16 : 0)
39 + | (sys_acl_get_perm(permset, SMB_ACL_CHOWN) ? 32 : 0)
40 | (sys_acl_get_perm(permset, SMB_ACL_EXECUTE) ? 1 : 0);
41 /* continue == done with entry; break == store in temporary ida list */
43 @@ -376,6 +379,12 @@ static int store_access_in_entry(uchar a
45 COE( sys_acl_get_permset,(entry, &permset) );
46 COE( sys_acl_clear_perms,(permset) );
48 + COE( sys_acl_add_perm(permset, SMB_ACL_CHOWN) );
50 + COE( sys_acl_add_perm(permset, SMB_ACL_CHMOD) );
52 + COE( sys_acl_add_perm(permset, SMB_ACL_DELETE) );
54 COE( sys_acl_add_perm,(permset, SMB_ACL_READ) );
56 @@ -409,7 +418,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
58 COE( sys_acl_create_entry,(smb_acl, &entry) );
59 COE( sys_acl_set_tag_type,(entry, SMB_ACL_USER_OBJ) );
60 - COE2( store_access_in_entry,(racl->user_obj & 7, entry) );
61 + COE2( store_access_in_entry,(racl->user_obj & 077, entry) );
63 for (ida = racl->users.idas, count = racl->users.count; count--; ida++) {
64 COE( sys_acl_create_entry,(smb_acl, &entry) );
65 @@ -420,7 +429,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
67 COE( sys_acl_create_entry,(smb_acl, &entry) );
68 COE( sys_acl_set_tag_type,(entry, SMB_ACL_GROUP_OBJ) );
69 - COE2( store_access_in_entry,(racl->group_obj & 7, entry) );
70 + COE2( store_access_in_entry,(racl->group_obj & 077, entry) );
72 for (ida = racl->groups.idas, count = racl->groups.count; count--; ida++) {
73 COE( sys_acl_create_entry,(smb_acl, &entry) );
74 @@ -430,7 +439,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
78 - mask_bits = racl->mask == NO_ENTRY ? racl->group_obj & 7 : racl->mask;
79 + mask_bits = racl->mask == NO_ENTRY ? racl->group_obj & 077 : racl->mask;
80 COE( sys_acl_create_entry,(smb_acl, &entry) );
81 COE( sys_acl_set_tag_type,(entry, SMB_ACL_MASK) );
82 COE2( store_access_in_entry,(mask_bits, entry) );
83 @@ -444,7 +453,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
85 COE( sys_acl_create_entry,(smb_acl, &entry) );
86 COE( sys_acl_set_tag_type,(entry, SMB_ACL_OTHER) );
87 - COE2( store_access_in_entry,(racl->other & 7, entry) );
88 + COE2( store_access_in_entry,(racl->other & 077, entry) );
91 if (sys_acl_valid(*smb_acl) < 0)
92 @@ -649,7 +658,7 @@ static void receive_rsync_acl(rsync_acl
94 char tag = read_byte(f);
95 uchar access = read_byte(f);
96 - if (access & ~ (4 | 2 | 1)) {
97 + if (access & ~(32 | 16 | 8 | 4 | 2 | 1)) {
98 rprintf(FERROR, "receive_rsync_acl: bogus permset %o\n",
100 exit_cleanup(RERR_STREAMIO);
101 @@ -725,7 +734,7 @@ static void receive_rsync_acl(rsync_acl
102 racl->mask = NO_ENTRY;
104 } else if (racl->mask == NO_ENTRY) /* Must be non-empty with lists. */
105 - racl->mask = computed_mask_bits | (racl->group_obj & 7);
106 + racl->mask = computed_mask_bits | (racl->group_obj & 077);
109 /* Receive the ACL info the sender has included for this file-list entry. */
113 #define SMB_ACL_READ ACL_READ
114 #define SMB_ACL_WRITE ACL_WRITE
115 #define SMB_ACL_EXECUTE ACL_EXECUTE
116 +/* These are custom ACL bits used by Adaptec's modifications
117 + * to XFS on their SnapOS units. */
118 +#define SMB_ACL_DELETE 0x08
119 +#define SMB_ACL_CHMOD 0x10
120 +#define SMB_ACL_CHOWN 0x20
123 #define SMB_ACL_USER ACL_USER