1 Depends-On-Patch: acls.diff
3 After applying the above patch and this one, run these commands for a
7 ./configure --enable-acl-support
11 > Attached is a small patch which is meant to be applied to a copy of
12 > rsync which has already been patched with acl support (the acls.diff
13 > file in the patches folder). It allows the preservation of the delete,
14 > chmod, and chown bits which Adaptec has added to XFS on their SnapOS NAS
15 > units. This is nice for backing up files between different NAS units
16 > and preserving all of the Samba ACLs.
18 > I'm not sure how useful this patch will be because I'm not sure if any
19 > other NAS vendors have standardized on their extensions to POSIX ACLs to
20 > support Samba in the same manner that Adaptec has. FWIW, though, this
21 > will allow you to preserve acls when copying between different Adaptec
22 > based NAS units running SnapOS.
24 I (Wayne) tweaked the patch for style and to avoid using SMB_* constants
25 with literal values were needed.
29 @@ -146,6 +146,9 @@ static BOOL unpack_smb_acl(rsync_acl *ra
31 race->access = (sys_acl_get_perm(permset, SMB_ACL_READ) ? 4 : 0)
32 | (sys_acl_get_perm(permset, SMB_ACL_WRITE) ? 2 : 0)
33 + | (sys_acl_get_perm(permset, SMB_ACL_DELETE) ? 8 : 0)
34 + | (sys_acl_get_perm(permset, SMB_ACL_CHMOD) ? 16 : 0)
35 + | (sys_acl_get_perm(permset, SMB_ACL_CHOWN) ? 32 : 0)
36 | (sys_acl_get_perm(permset, SMB_ACL_EXECUTE) ? 1 : 0);
37 switch (race->tag_type) {
39 @@ -575,6 +578,21 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
40 errfun = "sys_acl_add_perm";
43 + if (race->access & 8)
44 + if (sys_acl_add_perm(permset, SMB_ACL_DELETE)) {
45 + errfun = "sys_acl_add_perm";
48 + if (race->access & 16)
49 + if (sys_acl_add_perm(permset, SMB_ACL_CHMOD)) {
50 + errfun = "sys_acl_add_perm";
53 + if (race->access & 32)
54 + if (sys_acl_add_perm(permset, SMB_ACL_CHOWN)) {
55 + errfun = "sys_acl_add_perm";
58 if (sys_acl_set_permset(entry, permset)) {
59 errfun = "sys_acl_set_permset";
61 @@ -634,7 +652,7 @@ static void receive_rsync_acl(rsync_acl
62 exit_cleanup(RERR_STREAMIO);
64 race->access = read_byte(f);
65 - if (race->access & ~ (4 | 2 | 1)) {
66 + if (race->access & ~(32 | 16 | 8 | 4 | 2 | 1)) {
67 rprintf(FERROR, "receive_rsync_acl: bogus permset %o\n",
69 exit_cleanup(RERR_STREAMIO);
73 #define SMB_ACL_READ ACL_READ
74 #define SMB_ACL_WRITE ACL_WRITE
75 #define SMB_ACL_EXECUTE ACL_EXECUTE
76 +/* These are custom ACL bits used by Adaptec's modifications
77 + * to XFS on their SnapOS units. */
78 +#define SMB_ACL_DELETE 0x08
79 +#define SMB_ACL_CHMOD 0x10
80 +#define SMB_ACL_CHOWN 0x20
83 #define SMB_ACL_USER ACL_USER