2 Unix SMB/Netbios implementation.
4 Portable SMB ACL interface
5 Copyright (C) Jeremy Allison 2000
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #if defined HAVE_POSIX_ACLS
27 /* This is an identity mapping (just remove the SMB_). */
29 #define SMB_ACL_TAG_T acl_tag_t
30 #define SMB_ACL_TYPE_T acl_type_t
31 #define SMB_ACL_PERMSET_T acl_permset_t
32 #define SMB_ACL_PERM_T acl_perm_t
33 #define SMB_ACL_READ ACL_READ
34 #define SMB_ACL_WRITE ACL_WRITE
35 #define SMB_ACL_EXECUTE ACL_EXECUTE
38 #define SMB_ACL_USER ACL_USER
39 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
40 #define SMB_ACL_GROUP ACL_GROUP
41 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
42 #define SMB_ACL_OTHER ACL_OTHER
43 #define SMB_ACL_MASK ACL_MASK
45 #define SMB_ACL_T acl_t
47 #define SMB_ACL_ENTRY_T acl_entry_t
49 #define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY
50 #define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY
52 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
53 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
55 #elif defined HAVE_TRU64_ACLS
57 /* This is for DEC/Compaq Tru64 UNIX */
59 #define SMB_ACL_TAG_T acl_tag_t
60 #define SMB_ACL_TYPE_T acl_type_t
61 #define SMB_ACL_PERMSET_T acl_permset_t
62 #define SMB_ACL_PERM_T acl_perm_t
63 #define SMB_ACL_READ ACL_READ
64 #define SMB_ACL_WRITE ACL_WRITE
65 #define SMB_ACL_EXECUTE ACL_EXECUTE
68 #define SMB_ACL_USER ACL_USER
69 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
70 #define SMB_ACL_GROUP ACL_GROUP
71 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
72 #define SMB_ACL_OTHER ACL_OTHER
73 #define SMB_ACL_MASK ACL_MASK
75 #define SMB_ACL_T acl_t
77 #define SMB_ACL_ENTRY_T acl_entry_t
79 #define SMB_ACL_FIRST_ENTRY 0
80 #define SMB_ACL_NEXT_ENTRY 1
82 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
83 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
85 #elif defined HAVE_UNIXWARE_ACLS || defined HAVE_SOLARIS_ACLS
87 * Donated by Michael Davidson <md@sco.COM> for UnixWare / OpenUNIX.
88 * Modified by Toomas Soome <tsoome@ut.ee> for Solaris.
91 /* SVR4.2 ES/MP ACLs */
92 typedef int SMB_ACL_TAG_T;
93 typedef int SMB_ACL_TYPE_T;
94 typedef ushort *SMB_ACL_PERMSET_T;
95 typedef ushort SMB_ACL_PERM_T;
96 #define SMB_ACL_READ 4
97 #define SMB_ACL_WRITE 2
98 #define SMB_ACL_EXECUTE 1
101 #define SMB_ACL_USER USER
102 #define SMB_ACL_USER_OBJ USER_OBJ
103 #define SMB_ACL_GROUP GROUP
104 #define SMB_ACL_GROUP_OBJ GROUP_OBJ
105 #define SMB_ACL_OTHER OTHER_OBJ
106 #define SMB_ACL_MASK CLASS_OBJ
108 typedef struct SMB_ACL_T {
115 typedef struct acl *SMB_ACL_ENTRY_T;
117 #define SMB_ACL_FIRST_ENTRY 0
118 #define SMB_ACL_NEXT_ENTRY 1
120 #define SMB_ACL_TYPE_ACCESS 0
121 #define SMB_ACL_TYPE_DEFAULT 1
124 #define SMB_ACL_LOSES_SPECIAL_MODE_BITS
127 #elif defined HAVE_HPUX_ACLS
130 * Based on the Solaris & UnixWare code.
134 #include <sys/aclv.h>
136 /* SVR4.2 ES/MP ACLs */
137 typedef int SMB_ACL_TAG_T;
138 typedef int SMB_ACL_TYPE_T;
139 typedef ushort *SMB_ACL_PERMSET_T;
140 typedef ushort SMB_ACL_PERM_T;
141 #define SMB_ACL_READ 4
142 #define SMB_ACL_WRITE 2
143 #define SMB_ACL_EXECUTE 1
146 #define SMB_ACL_USER USER
147 #define SMB_ACL_USER_OBJ USER_OBJ
148 #define SMB_ACL_GROUP GROUP
149 #define SMB_ACL_GROUP_OBJ GROUP_OBJ
150 #define SMB_ACL_OTHER OTHER_OBJ
151 #define SMB_ACL_MASK CLASS_OBJ
153 typedef struct SMB_ACL_T {
160 typedef struct acl *SMB_ACL_ENTRY_T;
162 #define SMB_ACL_FIRST_ENTRY 0
163 #define SMB_ACL_NEXT_ENTRY 1
165 #define SMB_ACL_TYPE_ACCESS 0
166 #define SMB_ACL_TYPE_DEFAULT 1
168 #elif defined HAVE_IRIX_ACLS
170 #define SMB_ACL_TAG_T acl_tag_t
171 #define SMB_ACL_TYPE_T acl_type_t
172 #define SMB_ACL_PERMSET_T acl_permset_t
173 #define SMB_ACL_PERM_T acl_perm_t
174 #define SMB_ACL_READ ACL_READ
175 #define SMB_ACL_WRITE ACL_WRITE
176 #define SMB_ACL_EXECUTE ACL_EXECUTE
179 #define SMB_ACL_USER ACL_USER
180 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
181 #define SMB_ACL_GROUP ACL_GROUP
182 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
183 #define SMB_ACL_OTHER ACL_OTHER_OBJ
184 #define SMB_ACL_MASK ACL_MASK
186 typedef struct SMB_ACL_T {
192 #define SMB_ACL_ENTRY_T acl_entry_t
194 #define SMB_ACL_FIRST_ENTRY 0
195 #define SMB_ACL_NEXT_ENTRY 1
197 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
198 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
200 #elif defined HAVE_AIX_ACLS
202 /* Donated by Medha Date, mdate@austin.ibm.com, for IBM */
204 #include "/usr/include/acl.h"
206 typedef uint *SMB_ACL_PERMSET_T;
208 struct acl_entry_link{
209 struct acl_entry_link *prevp;
210 struct new_acl_entry *entryp;
211 struct acl_entry_link *nextp;
215 struct new_acl_entry{
216 unsigned short ace_len;
217 unsigned short ace_type;
218 unsigned int ace_access;
219 struct ace_id ace_id[1];
222 #define SMB_ACL_ENTRY_T struct new_acl_entry*
223 #define SMB_ACL_T struct acl_entry_link*
225 #define SMB_ACL_TAG_T unsigned short
226 #define SMB_ACL_TYPE_T int
227 #define SMB_ACL_PERM_T uint
228 #define SMB_ACL_READ S_IRUSR
229 #define SMB_ACL_WRITE S_IWUSR
230 #define SMB_ACL_EXECUTE S_IXUSR
233 #define SMB_ACL_USER ACEID_USER
234 #define SMB_ACL_USER_OBJ 3
235 #define SMB_ACL_GROUP ACEID_GROUP
236 #define SMB_ACL_GROUP_OBJ 4
237 #define SMB_ACL_OTHER 5
238 #define SMB_ACL_MASK 6
241 #define SMB_ACL_FIRST_ENTRY 1
242 #define SMB_ACL_NEXT_ENTRY 2
244 #define SMB_ACL_TYPE_ACCESS 0
245 #define SMB_ACL_TYPE_DEFAULT 1
249 /* No ACLS - fake it. */
250 #define SMB_ACL_TAG_T int
251 #define SMB_ACL_TYPE_T int
252 #define SMB_ACL_PERMSET_T mode_t
253 #define SMB_ACL_PERM_T mode_t
254 #define SMB_ACL_READ S_IRUSR
255 #define SMB_ACL_WRITE S_IWUSR
256 #define SMB_ACL_EXECUTE S_IXUSR
259 #define SMB_ACL_USER 0
260 #define SMB_ACL_USER_OBJ 1
261 #define SMB_ACL_GROUP 2
262 #define SMB_ACL_GROUP_OBJ 3
263 #define SMB_ACL_OTHER 4
264 #define SMB_ACL_MASK 5
266 typedef struct SMB_ACL_T {
270 typedef struct SMB_ACL_ENTRY_T {
274 #define SMB_ACL_FIRST_ENTRY 0
275 #define SMB_ACL_NEXT_ENTRY 1
277 #define SMB_ACL_TYPE_ACCESS 0
278 #define SMB_ACL_TYPE_DEFAULT 1
280 #endif /* No ACLs. */
281 #endif /* _SMB_ACLS_H */