preparing for release of 2.2.3a
[Samba.git] / source / include / smb_acls.h
blob53adf39dbc5fb144da2fd58b7cf9ca3b7a2dc2e9
1 /*
2 Unix SMB/Netbios implementation.
3 Version 2.2.x
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.
22 #ifndef _SMB_ACLS_H
23 #define _SMB_ACLS_H
25 #include "includes.h"
27 #if defined(HAVE_POSIX_ACLS)
29 /* This is an identity mapping (just remove the SMB_). */
31 #define SMB_ACL_TAG_T acl_tag_t
32 #define SMB_ACL_TYPE_T acl_type_t
33 #define SMB_ACL_PERMSET_T acl_permset_t
34 #define SMB_ACL_PERM_T acl_perm_t
35 #define SMB_ACL_READ ACL_READ
36 #define SMB_ACL_WRITE ACL_WRITE
37 #define SMB_ACL_EXECUTE ACL_EXECUTE
39 /* Types of ACLs. */
40 #define SMB_ACL_USER ACL_USER
41 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
42 #define SMB_ACL_GROUP ACL_GROUP
43 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
44 #define SMB_ACL_OTHER ACL_OTHER
45 #define SMB_ACL_MASK ACL_MASK
47 #define SMB_ACL_T acl_t
49 #define SMB_ACL_ENTRY_T acl_entry_t
51 #define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY
52 #define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY
54 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
55 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
57 #elif defined(HAVE_TRU64_ACLS)
59 /* This is for DEC/Compaq Tru64 UNIX */
61 #define SMB_ACL_TAG_T acl_tag_t
62 #define SMB_ACL_TYPE_T acl_type_t
63 #define SMB_ACL_PERMSET_T acl_permset_t
64 #define SMB_ACL_PERM_T acl_perm_t
65 #define SMB_ACL_READ ACL_READ
66 #define SMB_ACL_WRITE ACL_WRITE
67 #define SMB_ACL_EXECUTE ACL_EXECUTE
69 /* Types of ACLs. */
70 #define SMB_ACL_USER ACL_USER
71 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
72 #define SMB_ACL_GROUP ACL_GROUP
73 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
74 #define SMB_ACL_OTHER ACL_OTHER
75 #define SMB_ACL_MASK ACL_MASK
77 #define SMB_ACL_T acl_t
79 #define SMB_ACL_ENTRY_T acl_entry_t
81 #define SMB_ACL_FIRST_ENTRY 0
82 #define SMB_ACL_NEXT_ENTRY 1
84 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
85 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
87 #elif defined(HAVE_UNIXWARE_ACLS) || defined(HAVE_SOLARIS_ACLS)
89 * Donated by Michael Davidson <md@sco.COM> for UnixWare / OpenUNIX.
90 * Modified by Toomas Soome <tsoome@ut.ee> for Solaris.
93 /* SVR4.2 ES/MP ACLs */
94 typedef int SMB_ACL_TAG_T;
95 typedef int SMB_ACL_TYPE_T;
96 typedef ushort *SMB_ACL_PERMSET_T;
97 typedef ushort SMB_ACL_PERM_T;
98 #define SMB_ACL_READ 4
99 #define SMB_ACL_WRITE 2
100 #define SMB_ACL_EXECUTE 1
102 /* Types of ACLs. */
103 #define SMB_ACL_USER USER
104 #define SMB_ACL_USER_OBJ USER_OBJ
105 #define SMB_ACL_GROUP GROUP
106 #define SMB_ACL_GROUP_OBJ GROUP_OBJ
107 #define SMB_ACL_OTHER OTHER_OBJ
108 #define SMB_ACL_MASK CLASS_OBJ
110 typedef struct SMB_ACL_T {
111 int size;
112 int count;
113 int next;
114 struct acl acl[1];
115 } *SMB_ACL_T;
117 typedef struct acl *SMB_ACL_ENTRY_T;
119 #define SMB_ACL_FIRST_ENTRY 0
120 #define SMB_ACL_NEXT_ENTRY 1
122 #define SMB_ACL_TYPE_ACCESS 0
123 #define SMB_ACL_TYPE_DEFAULT 1
125 #elif defined(HAVE_HPUX_ACLS)
128 * Based on the Solaris & UnixWare code.
131 #undef GROUP
132 #include <sys/aclv.h>
134 /* SVR4.2 ES/MP ACLs */
135 typedef int SMB_ACL_TAG_T;
136 typedef int SMB_ACL_TYPE_T;
137 typedef ushort *SMB_ACL_PERMSET_T;
138 typedef ushort SMB_ACL_PERM_T;
139 #define SMB_ACL_READ 4
140 #define SMB_ACL_WRITE 2
141 #define SMB_ACL_EXECUTE 1
143 /* Types of ACLs. */
144 #define SMB_ACL_USER USER
145 #define SMB_ACL_USER_OBJ USER_OBJ
146 #define SMB_ACL_GROUP GROUP
147 #define SMB_ACL_GROUP_OBJ GROUP_OBJ
148 #define SMB_ACL_OTHER OTHER_OBJ
149 #define SMB_ACL_MASK CLASS_OBJ
151 typedef struct SMB_ACL_T {
152 int size;
153 int count;
154 int next;
155 struct acl acl[1];
156 } *SMB_ACL_T;
158 typedef struct acl *SMB_ACL_ENTRY_T;
160 #define SMB_ACL_FIRST_ENTRY 0
161 #define SMB_ACL_NEXT_ENTRY 1
163 #define SMB_ACL_TYPE_ACCESS 0
164 #define SMB_ACL_TYPE_DEFAULT 1
166 #elif defined(HAVE_IRIX_ACLS)
168 #define SMB_ACL_TAG_T acl_tag_t
169 #define SMB_ACL_TYPE_T acl_type_t
170 #define SMB_ACL_PERMSET_T acl_permset_t
171 #define SMB_ACL_PERM_T acl_perm_t
172 #define SMB_ACL_READ ACL_READ
173 #define SMB_ACL_WRITE ACL_WRITE
174 #define SMB_ACL_EXECUTE ACL_EXECUTE
176 /* Types of ACLs. */
177 #define SMB_ACL_USER ACL_USER
178 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
179 #define SMB_ACL_GROUP ACL_GROUP
180 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
181 #define SMB_ACL_OTHER ACL_OTHER_OBJ
182 #define SMB_ACL_MASK ACL_MASK
184 typedef struct SMB_ACL_T {
185 int next;
186 BOOL freeaclp;
187 struct acl *aclp;
188 } *SMB_ACL_T;
190 #define SMB_ACL_ENTRY_T acl_entry_t
192 #define SMB_ACL_FIRST_ENTRY 0
193 #define SMB_ACL_NEXT_ENTRY 1
195 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
196 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
198 #elif defined(HAVE_AIX_ACLS)
200 /* Donated by Medha Date, mdate@austin.ibm.com, for IBM */
202 #include "/usr/include/acl.h"
204 typedef uint *SMB_ACL_PERMSET_T;
206 struct acl_entry_link{
207 struct acl_entry_link *prevp;
208 struct new_acl_entry *entryp;
209 struct acl_entry_link *nextp;
210 int count;
213 struct new_acl_entry{
214 unsigned short ace_len;
215 unsigned short ace_type;
216 unsigned int ace_access;
217 struct ace_id ace_id[1];
220 #define SMB_ACL_ENTRY_T struct new_acl_entry*
221 #define SMB_ACL_T struct acl_entry_link*
223 #define SMB_ACL_TAG_T unsigned short
224 #define SMB_ACL_TYPE_T int
225 #define SMB_ACL_PERM_T uint
226 #define SMB_ACL_READ S_IRUSR
227 #define SMB_ACL_WRITE S_IWUSR
228 #define SMB_ACL_EXECUTE S_IXUSR
230 /* Types of ACLs. */
231 #define SMB_ACL_USER ACEID_USER
232 #define SMB_ACL_USER_OBJ 3
233 #define SMB_ACL_GROUP ACEID_GROUP
234 #define SMB_ACL_GROUP_OBJ 4
235 #define SMB_ACL_OTHER 5
236 #define SMB_ACL_MASK 6
239 #define SMB_ACL_FIRST_ENTRY 1
240 #define SMB_ACL_NEXT_ENTRY 2
242 #define SMB_ACL_TYPE_ACCESS 0
243 #define SMB_ACL_TYPE_DEFAULT 1
245 #else /* No ACLs. */
247 /* No ACLS - fake it. */
248 #define SMB_ACL_TAG_T int
249 #define SMB_ACL_TYPE_T int
250 #define SMB_ACL_PERMSET_T mode_t
251 #define SMB_ACL_PERM_T mode_t
252 #define SMB_ACL_READ S_IRUSR
253 #define SMB_ACL_WRITE S_IWUSR
254 #define SMB_ACL_EXECUTE S_IXUSR
256 /* Types of ACLs. */
257 #define SMB_ACL_USER 0
258 #define SMB_ACL_USER_OBJ 1
259 #define SMB_ACL_GROUP 2
260 #define SMB_ACL_GROUP_OBJ 3
261 #define SMB_ACL_OTHER 4
262 #define SMB_ACL_MASK 5
264 typedef struct SMB_ACL_T {
265 int dummy;
266 } *SMB_ACL_T;
268 typedef struct SMB_ACL_ENTRY_T {
269 int dummy;
270 } *SMB_ACL_ENTRY_T;
272 #define SMB_ACL_FIRST_ENTRY 0
273 #define SMB_ACL_NEXT_ENTRY 1
275 #define SMB_ACL_TYPE_ACCESS 0
276 #define SMB_ACL_TYPE_DEFAULT 1
278 #endif /* No ACLs. */
279 #endif /* _SMB_ACLS_H */