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