syncing up changes in 2.2
[Samba.git] / source / include / smb_acls.h
blob613f6db3e322e7954ea380c140f2b0cde1850dfc
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_UNIXWARE_ACLS) || defined(HAVE_SOLARIS_ACLS)
59 * Donated by Michael Davidson <md@sco.COM> for UnixWare / OpenUNIX.
60 * Modified by Toomas Soome <tsoome@ut.ee> for Solaris.
63 /* SVR4.2 ES/MP ACLs */
64 typedef int SMB_ACL_TAG_T;
65 typedef int SMB_ACL_TYPE_T;
66 typedef ushort *SMB_ACL_PERMSET_T;
67 typedef ushort SMB_ACL_PERM_T;
68 #define SMB_ACL_READ 4
69 #define SMB_ACL_WRITE 2
70 #define SMB_ACL_EXECUTE 1
72 /* Types of ACLs. */
73 #define SMB_ACL_USER USER
74 #define SMB_ACL_USER_OBJ USER_OBJ
75 #define SMB_ACL_GROUP GROUP
76 #define SMB_ACL_GROUP_OBJ GROUP_OBJ
77 #define SMB_ACL_OTHER OTHER_OBJ
78 #define SMB_ACL_MASK CLASS_OBJ
80 typedef struct SMB_ACL_T {
81 int size;
82 int count;
83 int next;
84 struct acl acl[1];
85 } *SMB_ACL_T;
87 typedef struct acl *SMB_ACL_ENTRY_T;
89 #define SMB_ACL_FIRST_ENTRY 0
90 #define SMB_ACL_NEXT_ENTRY 1
92 #define SMB_ACL_TYPE_ACCESS 0
93 #define SMB_ACL_TYPE_DEFAULT 1
95 #elif defined(HAVE_IRIX_ACLS)
97 #define SMB_ACL_TAG_T acl_tag_t
98 #define SMB_ACL_TYPE_T acl_type_t
99 #define SMB_ACL_PERMSET_T acl_permset_t
100 #define SMB_ACL_PERM_T acl_perm_t
101 #define SMB_ACL_READ ACL_READ
102 #define SMB_ACL_WRITE ACL_WRITE
103 #define SMB_ACL_EXECUTE ACL_EXECUTE
105 /* Types of ACLs. */
106 #define SMB_ACL_USER ACL_USER
107 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
108 #define SMB_ACL_GROUP ACL_GROUP
109 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
110 #define SMB_ACL_OTHER ACL_OTHER_OBJ
111 #define SMB_ACL_MASK ACL_MASK
113 typedef struct SMB_ACL_T {
114 int next;
115 BOOL freeaclp;
116 struct acl *aclp;
117 } *SMB_ACL_T;
119 #define SMB_ACL_ENTRY_T acl_entry_t
121 #define SMB_ACL_FIRST_ENTRY 0
122 #define SMB_ACL_NEXT_ENTRY 1
124 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
125 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
127 /* XFS ACLS are defined here */
128 /* donated by John Trostel (jtrostel@connex.com) */
130 #elif defined(HAVE_XFS_ACLS)
132 /* This is an nearly an identity mapping (just remove the SMB_). */
133 #define SMB_ACL_TAG_T acl_tag_t
134 #define SMB_ACL_TYPE_T acl_type_t
135 //#define SMB_ACL_PERMSET_T acl_permset_t
136 typedef ushort *SMB_ACL_PERMSET_T;
137 #define SMB_ACL_PERM_T acl_perm_t
138 #define SMB_ACL_READ ACL_READ
139 #define SMB_ACL_WRITE ACL_WRITE
140 #define SMB_ACL_EXECUTE ACL_EXECUTE
142 /* Types of ACLs. */
143 #define SMB_ACL_USER ACL_USER
144 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
145 #define SMB_ACL_GROUP ACL_GROUP
146 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
147 #define SMB_ACL_OTHER ACL_OTHER_OBJ
148 #define SMB_ACL_MASK ACL_MASK
150 #define SMB_ACL_T acl_t
152 #define SMB_ACL_ENTRY_T acl_entry_t
154 #define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY
155 #define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY
157 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
158 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
160 /* Not yet in Official SGI XFS CVS */
162 #if defined(CONFIG_EXTENDED_PERMISSSION)
163 #define SMB_ACL_CHOWN ACL_CHOWN
164 #define SMB_ACL_CHMOD ACL_CHMOD
165 #define SMB_ACL_DELETE ACL_DELETE
166 #define EXTENDED_PERM_BITS (ACL_CHOWN|ACL_CHMOD|ACL_DELETE)
167 #endif /* CONFIG_EXTENDED_PERMISSION */
169 #elif defined(HAVE_AIX_ACLS)
171 /* Donated by Medha Date, mdate@austin.ibm.com, for IBM */
173 #include "/usr/include/acl.h"
175 typedef uint *SMB_ACL_PERMSET_T;
177 struct acl_entry_link{
178 struct acl_entry_link *prevp;
179 struct new_acl_entry *entryp;
180 struct acl_entry_link *nextp;
181 int count;
184 struct new_acl_entry{
185 unsigned short ace_len;
186 unsigned short ace_type;
187 unsigned int ace_access;
188 struct ace_id ace_id[1];
191 #define SMB_ACL_ENTRY_T struct new_acl_entry*
192 #define SMB_ACL_T struct acl_entry_link*
194 #define SMB_ACL_TAG_T unsigned short
195 #define SMB_ACL_TYPE_T int
196 #define SMB_ACL_PERM_T uint
197 #define SMB_ACL_READ S_IRUSR
198 #define SMB_ACL_WRITE S_IWUSR
199 #define SMB_ACL_EXECUTE S_IXUSR
201 /* Types of ACLs. */
202 #define SMB_ACL_USER ACEID_USER
203 #define SMB_ACL_USER_OBJ 3
204 #define SMB_ACL_GROUP ACEID_GROUP
205 #define SMB_ACL_GROUP_OBJ 4
206 #define SMB_ACL_OTHER 5
207 #define SMB_ACL_MASK 6
210 #define SMB_ACL_FIRST_ENTRY 1
211 #define SMB_ACL_NEXT_ENTRY 2
213 #define SMB_ACL_TYPE_ACCESS 0
214 #define SMB_ACL_TYPE_DEFAULT 1
216 #else /* No ACLs. */
218 /* No ACLS - fake it. */
219 #define SMB_ACL_TAG_T int
220 #define SMB_ACL_TYPE_T int
221 #define SMB_ACL_PERMSET_T mode_t
222 #define SMB_ACL_PERM_T mode_t
223 #define SMB_ACL_READ S_IRUSR
224 #define SMB_ACL_WRITE S_IWUSR
225 #define SMB_ACL_EXECUTE S_IXUSR
227 /* Types of ACLs. */
228 #define SMB_ACL_USER 0
229 #define SMB_ACL_USER_OBJ 1
230 #define SMB_ACL_GROUP 2
231 #define SMB_ACL_GROUP_OBJ 3
232 #define SMB_ACL_OTHER 4
233 #define SMB_ACL_MASK 5
235 typedef struct SMB_ACL_T {
236 int dummy;
237 } *SMB_ACL_T;
239 typedef struct SMB_ACL_ENTRY_T {
240 int dummy;
241 } *SMB_ACL_ENTRY_T;
243 #define SMB_ACL_FIRST_ENTRY 0
244 #define SMB_ACL_NEXT_ENTRY 1
246 #define SMB_ACL_TYPE_ACCESS 0
247 #define SMB_ACL_TYPE_DEFAULT 1
249 #endif /* No ACLs. */
250 #endif /* _SMB_ACLS_H */