Fixed failing hunks.
[rsync/rsync-patches.git] / adaptec_acl_mods.diff
CommitLineData
03019e41 1To 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 8Philip 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.
13>
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 20I (Wayne) tweaked the patch to work with the latest source.
af7ee4d8 21
25b3348d 22Todo:
d3832800 23
25b3348d
WD
24Fix a bug that could lose some bits when stripping some (supposedly)
25superfluous ACL info.
26
27--- old/lib/sysacls.c
28+++ new/lib/sysacls.c
52e09c4e 29@@ -30,6 +30,18 @@
25b3348d
WD
30 #endif
31 #define DEBUG(x,y)
4306c620 32
af7ee4d8
WD
33+/* These are custom ACL bits used by Adaptec's modifications
34+ * to XFS on their SnapOS units. */
25b3348d
WD
35+#ifndef ACL_DELETE
36+#define ACL_DELETE 8
37+#endif
38+#ifndef ACL_CHMOD
39+#define ACL_CHMOD 16
40+#endif
41+#ifndef ACL_CHOWN
42+#define ACL_CHOWN 32
43+#endif
44+
45 void SAFE_FREE(void *mem)
46 {
47 if (mem)
52e09c4e
WD
48@@ -99,6 +111,9 @@ int sys_acl_get_info(SMB_ACL_ENTRY_T ent
49 return -1;
50
51 *bits_p = (acl_get_perm(permset, ACL_READ) ? 4 : 0)
52+ | (acl_get_perm(permset, ACL_CHOWN) ? 32 : 0)
53+ | (acl_get_perm(permset, ACL_CHMOD) ? 16 : 0)
54+ | (acl_get_perm(permset, ACL_DELETE) ? 8 : 0)
55 | (acl_get_perm(permset, ACL_WRITE) ? 2 : 0)
56 | (acl_get_perm(permset, ACL_EXECUTE) ? 1 : 0);
57
58@@ -143,6 +158,12 @@ int sys_acl_set_access_bits(SMB_ACL_ENTR
25b3348d
WD
59 if ((rc = acl_get_permset(entry, &permset)) != 0)
60 return rc;
61 acl_clear_perms(permset);
62+ if (bits & 32)
63+ acl_add_perm(permset, ACL_CHOWN);
64+ if (bits & 16)
65+ acl_add_perm(permset, ACL_CHMOD);
66+ if (bits & 8)
67+ acl_add_perm(permset, ACL_DELETE);
68 if (bits & 4)
69 acl_add_perm(permset, ACL_READ);
70 if (bits & 2)
71--- old/lib/sysacls.h
72+++ new/lib/sysacls.h
52e09c4e 73@@ -58,8 +58,8 @@
25b3348d
WD
74 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
75 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
76
77-#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1)
78-#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1)
79+#define SMB_ACL_VALID_NAME_BITS (32 | 16 | 8 | 4 | 2 | 1)
80+#define SMB_ACL_VALID_OBJ_BITS (32 | 16 | 8 | 4 | 2 | 1)
81
82 #define SMB_ACL_NEED_SORT
af7ee4d8 83