2 Unix SMB/CIFS implementation.
3 Portable SMB ACL interface
4 Copyright (C) Jeremy Allison 2000
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #if defined(HAVE_POSIX_ACLS)
28 /* This is an identity mapping (just remove the SMB_). */
30 #define SMB_ACL_TAG_T acl_tag_t
31 #define SMB_ACL_TYPE_T acl_type_t
32 #define SMB_ACL_PERMSET_T acl_permset_t
33 #define SMB_ACL_PERM_T acl_perm_t
34 #define SMB_ACL_READ ACL_READ
35 #define SMB_ACL_WRITE ACL_WRITE
36 #define SMB_ACL_EXECUTE ACL_EXECUTE
39 #define SMB_ACL_USER ACL_USER
40 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
41 #define SMB_ACL_GROUP ACL_GROUP
42 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
43 #define SMB_ACL_OTHER ACL_OTHER
44 #define SMB_ACL_MASK ACL_MASK
46 #define SMB_ACL_T acl_t
48 #define SMB_ACL_ENTRY_T acl_entry_t
50 #define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY
51 #define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY
53 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
54 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
56 #elif defined(HAVE_TRU64_ACLS)
58 /* This is for DEC/Compaq Tru64 UNIX */
60 #define SMB_ACL_TAG_T acl_tag_t
61 #define SMB_ACL_TYPE_T acl_type_t
62 #define SMB_ACL_PERMSET_T acl_permset_t
63 #define SMB_ACL_PERM_T acl_perm_t
64 #define SMB_ACL_READ ACL_READ
65 #define SMB_ACL_WRITE ACL_WRITE
66 #define SMB_ACL_EXECUTE ACL_EXECUTE
69 #define SMB_ACL_USER ACL_USER
70 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
71 #define SMB_ACL_GROUP ACL_GROUP
72 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
73 #define SMB_ACL_OTHER ACL_OTHER
74 #define SMB_ACL_MASK ACL_MASK
76 #define SMB_ACL_T acl_t
78 #define SMB_ACL_ENTRY_T acl_entry_t
80 #define SMB_ACL_FIRST_ENTRY 0
81 #define SMB_ACL_NEXT_ENTRY 1
83 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
84 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
86 #elif defined(HAVE_UNIXWARE_ACLS) || defined(HAVE_SOLARIS_ACLS)
88 * Donated by Michael Davidson <md@sco.COM> for UnixWare / OpenUNIX.
89 * Modified by Toomas Soome <tsoome@ut.ee> for Solaris.
92 /* SVR4.2 ES/MP ACLs */
93 typedef int SMB_ACL_TAG_T;
94 typedef int SMB_ACL_TYPE_T;
95 typedef ushort *SMB_ACL_PERMSET_T;
96 typedef ushort SMB_ACL_PERM_T;
97 #define SMB_ACL_READ 4
98 #define SMB_ACL_WRITE 2
99 #define SMB_ACL_EXECUTE 1
102 #define SMB_ACL_USER USER
103 #define SMB_ACL_USER_OBJ USER_OBJ
104 #define SMB_ACL_GROUP GROUP
105 #define SMB_ACL_GROUP_OBJ GROUP_OBJ
106 #define SMB_ACL_OTHER OTHER_OBJ
107 #define SMB_ACL_MASK CLASS_OBJ
109 typedef struct SMB_ACL_T {
116 typedef struct acl *SMB_ACL_ENTRY_T;
118 #define SMB_ACL_FIRST_ENTRY 0
119 #define SMB_ACL_NEXT_ENTRY 1
121 #define SMB_ACL_TYPE_ACCESS 0
122 #define SMB_ACL_TYPE_DEFAULT 1
124 #elif defined(HAVE_HPUX_ACLS)
127 * Based on the Solaris & UnixWare code.
131 #include <sys/aclv.h>
133 /* SVR4.2 ES/MP ACLs */
134 typedef int SMB_ACL_TAG_T;
135 typedef int SMB_ACL_TYPE_T;
136 typedef ushort *SMB_ACL_PERMSET_T;
137 typedef ushort SMB_ACL_PERM_T;
138 #define SMB_ACL_READ 4
139 #define SMB_ACL_WRITE 2
140 #define SMB_ACL_EXECUTE 1
143 #define SMB_ACL_USER USER
144 #define SMB_ACL_USER_OBJ USER_OBJ
145 #define SMB_ACL_GROUP GROUP
146 #define SMB_ACL_GROUP_OBJ GROUP_OBJ
147 #define SMB_ACL_OTHER OTHER_OBJ
148 #define SMB_ACL_MASK CLASS_OBJ
150 typedef struct SMB_ACL_T {
157 typedef struct acl *SMB_ACL_ENTRY_T;
159 #define SMB_ACL_FIRST_ENTRY 0
160 #define SMB_ACL_NEXT_ENTRY 1
162 #define SMB_ACL_TYPE_ACCESS 0
163 #define SMB_ACL_TYPE_DEFAULT 1
165 #elif defined(HAVE_IRIX_ACLS)
167 #define SMB_ACL_TAG_T acl_tag_t
168 #define SMB_ACL_TYPE_T acl_type_t
169 #define SMB_ACL_PERMSET_T acl_permset_t
170 #define SMB_ACL_PERM_T acl_perm_t
171 #define SMB_ACL_READ ACL_READ
172 #define SMB_ACL_WRITE ACL_WRITE
173 #define SMB_ACL_EXECUTE ACL_EXECUTE
176 #define SMB_ACL_USER ACL_USER
177 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
178 #define SMB_ACL_GROUP ACL_GROUP
179 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
180 #define SMB_ACL_OTHER ACL_OTHER_OBJ
181 #define SMB_ACL_MASK ACL_MASK
183 typedef struct SMB_ACL_T {
189 #define SMB_ACL_ENTRY_T acl_entry_t
191 #define SMB_ACL_FIRST_ENTRY 0
192 #define SMB_ACL_NEXT_ENTRY 1
194 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
195 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
197 #elif defined(HAVE_AIX_ACLS)
199 /* Donated by Medha Date, mdate@austin.ibm.com, for IBM */
201 #include "/usr/include/acl.h"
203 typedef uint *SMB_ACL_PERMSET_T;
205 struct acl_entry_link{
206 struct acl_entry_link *prevp;
207 struct new_acl_entry *entryp;
208 struct acl_entry_link *nextp;
212 struct new_acl_entry{
213 unsigned short ace_len;
214 unsigned short ace_type;
215 unsigned int ace_access;
216 struct ace_id ace_id[1];
219 #define SMB_ACL_ENTRY_T struct new_acl_entry*
220 #define SMB_ACL_T struct acl_entry_link*
222 #define SMB_ACL_TAG_T unsigned short
223 #define SMB_ACL_TYPE_T int
224 #define SMB_ACL_PERM_T uint
225 #define SMB_ACL_READ S_IRUSR
226 #define SMB_ACL_WRITE S_IWUSR
227 #define SMB_ACL_EXECUTE S_IXUSR
230 #define SMB_ACL_USER ACEID_USER
231 #define SMB_ACL_USER_OBJ 3
232 #define SMB_ACL_GROUP ACEID_GROUP
233 #define SMB_ACL_GROUP_OBJ 4
234 #define SMB_ACL_OTHER 5
235 #define SMB_ACL_MASK 6
238 #define SMB_ACL_FIRST_ENTRY 1
239 #define SMB_ACL_NEXT_ENTRY 2
241 #define SMB_ACL_TYPE_ACCESS 0
242 #define SMB_ACL_TYPE_DEFAULT 1
246 /* No ACLS - fake it. */
247 #define SMB_ACL_TAG_T int
248 #define SMB_ACL_TYPE_T int
249 #define SMB_ACL_PERMSET_T mode_t
250 #define SMB_ACL_PERM_T mode_t
251 #define SMB_ACL_READ S_IRUSR
252 #define SMB_ACL_WRITE S_IWUSR
253 #define SMB_ACL_EXECUTE S_IXUSR
256 #define SMB_ACL_USER 0
257 #define SMB_ACL_USER_OBJ 1
258 #define SMB_ACL_GROUP 2
259 #define SMB_ACL_GROUP_OBJ 3
260 #define SMB_ACL_OTHER 4
261 #define SMB_ACL_MASK 5
263 typedef struct SMB_ACL_T {
267 typedef struct SMB_ACL_ENTRY_T {
271 #define SMB_ACL_FIRST_ENTRY 0
272 #define SMB_ACL_NEXT_ENTRY 1
274 #define SMB_ACL_TYPE_ACCESS 0
275 #define SMB_ACL_TYPE_DEFAULT 1
277 #endif /* No ACLs. */
278 #endif /* _SMB_ACLS_H */