Commit | Line | Data |
---|---|---|
03019e41 | 1 | To use this patch, run these commands for a successful build: |
1fcc420a | 2 | |
03019e41 | 3 | patch -p1 <patches/adaptec_acl_mods.diff |
1fcc420a WD |
4 | ./prepare-source |
5 | ./configure --enable-acl-support | |
6 | make | |
7 | ||
af7ee4d8 | 8 | Philip Lowman wrote: |
25b3348d | 9 | > Attached is a small patch which allows the preservation of the delete, |
af7ee4d8 WD |
10 | > chmod, and chown bits which Adaptec has added to XFS on their SnapOS NAS |
11 | > units. This is nice for backing up files between different NAS units | |
12 | > and preserving all of the Samba ACLs. | |
e2e42a01 | 13 | > |
af7ee4d8 WD |
14 | > I'm not sure how useful this patch will be because I'm not sure if any |
15 | > other NAS vendors have standardized on their extensions to POSIX ACLs to | |
16 | > support Samba in the same manner that Adaptec has. FWIW, though, this | |
17 | > will allow you to preserve acls when copying between different Adaptec | |
18 | > based NAS units running SnapOS. | |
19 | ||
25b3348d | 20 | I (Wayne) tweaked the patch to work with the latest source. |
af7ee4d8 | 21 | |
25b3348d | 22 | Todo: |
d3832800 | 23 | |
25b3348d WD |
24 | Fix a bug that could lose some bits when stripping some (supposedly) |
25 | superfluous ACL info. | |
26 | ||
c1ff70aa | 27 | based-on: a01e3b490eb36ccf9e704840e1b6683dab867550 |
cc3e685d WD |
28 | diff --git a/lib/sysacls.c b/lib/sysacls.c |
29 | --- a/lib/sysacls.c | |
30 | +++ b/lib/sysacls.c | |
f9df736a | 31 | @@ -31,6 +31,18 @@ |
25b3348d WD |
32 | #endif |
33 | #define DEBUG(x,y) | |
4306c620 | 34 | |
af7ee4d8 WD |
35 | +/* These are custom ACL bits used by Adaptec's modifications |
36 | + * to XFS on their SnapOS units. */ | |
25b3348d WD |
37 | +#ifndef ACL_DELETE |
38 | +#define ACL_DELETE 8 | |
39 | +#endif | |
40 | +#ifndef ACL_CHMOD | |
41 | +#define ACL_CHMOD 16 | |
42 | +#endif | |
43 | +#ifndef ACL_CHOWN | |
44 | +#define ACL_CHOWN 32 | |
45 | +#endif | |
46 | + | |
47 | void SAFE_FREE(void *mem) | |
48 | { | |
49 | if (mem) | |
f9df736a | 50 | @@ -100,6 +112,9 @@ int sys_acl_get_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T *tag_type_p, uint32 *b |
52e09c4e WD |
51 | return -1; |
52 | ||
53 | *bits_p = (acl_get_perm(permset, ACL_READ) ? 4 : 0) | |
54 | + | (acl_get_perm(permset, ACL_CHOWN) ? 32 : 0) | |
55 | + | (acl_get_perm(permset, ACL_CHMOD) ? 16 : 0) | |
56 | + | (acl_get_perm(permset, ACL_DELETE) ? 8 : 0) | |
57 | | (acl_get_perm(permset, ACL_WRITE) ? 2 : 0) | |
58 | | (acl_get_perm(permset, ACL_EXECUTE) ? 1 : 0); | |
59 | ||
f9df736a | 60 | @@ -144,6 +159,12 @@ int sys_acl_set_access_bits(SMB_ACL_ENTRY_T entry, uint32 bits) |
25b3348d WD |
61 | if ((rc = acl_get_permset(entry, &permset)) != 0) |
62 | return rc; | |
63 | acl_clear_perms(permset); | |
64 | + if (bits & 32) | |
65 | + acl_add_perm(permset, ACL_CHOWN); | |
66 | + if (bits & 16) | |
67 | + acl_add_perm(permset, ACL_CHMOD); | |
68 | + if (bits & 8) | |
69 | + acl_add_perm(permset, ACL_DELETE); | |
70 | if (bits & 4) | |
71 | acl_add_perm(permset, ACL_READ); | |
72 | if (bits & 2) | |
cc3e685d WD |
73 | diff --git a/lib/sysacls.h b/lib/sysacls.h |
74 | --- a/lib/sysacls.h | |
75 | +++ b/lib/sysacls.h | |
f9df736a | 76 | @@ -59,8 +59,8 @@ |
25b3348d WD |
77 | #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS |
78 | #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT | |
79 | ||
80 | -#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1) | |
81 | -#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1) | |
82 | +#define SMB_ACL_VALID_NAME_BITS (32 | 16 | 8 | 4 | 2 | 1) | |
83 | +#define SMB_ACL_VALID_OBJ_BITS (32 | 16 | 8 | 4 | 2 | 1) | |
84 | ||
85 | #define SMB_ACL_NEED_SORT | |
af7ee4d8 | 86 |