Commit | Line | Data |
---|---|---|
af7ee4d8 WD |
1 | Depends-On-Patch: acls.diff |
2 | ||
1fcc420a WD |
3 | After applying the above patch and this one, run these commands for a |
4 | successful build: | |
5 | ||
6 | ./prepare-source | |
7 | ./configure --enable-acl-support | |
8 | make | |
9 | ||
af7ee4d8 WD |
10 | Philip Lowman wrote: |
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. | |
17 | > | |
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. | |
23 | ||
24 | I (Wayne) tweaked the patch for style and to avoid using SMB_* constants | |
25 | with literal values were needed. | |
26 | ||
27 | --- old/acls.c | |
28 | +++ new/acls.c | |
29 | @@ -146,6 +146,9 @@ static BOOL unpack_smb_acl(rsync_acl *ra | |
30 | } | |
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) { | |
38 | case SMB_ACL_USER: | |
39 | @@ -575,6 +578,21 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_ | |
40 | errfun = "sys_acl_add_perm"; | |
41 | break; | |
42 | } | |
43 | + if (race->access & 8) | |
44 | + if (sys_acl_add_perm(permset, SMB_ACL_DELETE)) { | |
45 | + errfun = "sys_acl_add_perm"; | |
46 | + break; | |
47 | + } | |
48 | + if (race->access & 16) | |
49 | + if (sys_acl_add_perm(permset, SMB_ACL_CHMOD)) { | |
50 | + errfun = "sys_acl_add_perm"; | |
51 | + break; | |
52 | + } | |
53 | + if (race->access & 32) | |
54 | + if (sys_acl_add_perm(permset, SMB_ACL_CHOWN)) { | |
55 | + errfun = "sys_acl_add_perm"; | |
56 | + break; | |
57 | + } | |
58 | if (sys_acl_set_permset(entry, permset)) { | |
59 | errfun = "sys_acl_set_permset"; | |
60 | break; | |
61 | @@ -634,7 +652,7 @@ static void receive_rsync_acl(rsync_acl | |
62 | exit_cleanup(RERR_STREAMIO); | |
63 | } | |
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", | |
68 | race->access); | |
69 | exit_cleanup(RERR_STREAMIO); | |
70 | --- old/smb_acls.h | |
71 | +++ new/smb_acls.h | |
72 | @@ -33,6 +33,11 @@ | |
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 | |
81 | ||
82 | /* Types of ACLs. */ | |
83 | #define SMB_ACL_USER ACL_USER |