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.
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
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_DRAFT13_POSIX_ACLS)
59 /* This is for DEC OSF/1 */
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
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
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 {
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_IRIX_ACLS)
127 #define SMB_ACL_TAG_T acl_tag_t
128 #define SMB_ACL_TYPE_T acl_type_t
129 #define SMB_ACL_PERMSET_T acl_permset_t
130 #define SMB_ACL_PERM_T acl_perm_t
131 #define SMB_ACL_READ ACL_READ
132 #define SMB_ACL_WRITE ACL_WRITE
133 #define SMB_ACL_EXECUTE ACL_EXECUTE
136 #define SMB_ACL_USER ACL_USER
137 #define SMB_ACL_USER_OBJ ACL_USER_OBJ
138 #define SMB_ACL_GROUP ACL_GROUP
139 #define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
140 #define SMB_ACL_OTHER ACL_OTHER_OBJ
141 #define SMB_ACL_MASK ACL_MASK
143 typedef struct SMB_ACL_T {
149 #define SMB_ACL_ENTRY_T acl_entry_t
151 #define SMB_ACL_FIRST_ENTRY 0
152 #define SMB_ACL_NEXT_ENTRY 1
154 #define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
155 #define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
157 #elif defined(HAVE_AIX_ACLS)
159 /* Donated by Medha Date, mdate@austin.ibm.com, for IBM */
161 #include "/usr/include/acl.h"
163 typedef uint *SMB_ACL_PERMSET_T;
165 struct acl_entry_link{
166 struct acl_entry_link *prevp;
167 struct new_acl_entry *entryp;
168 struct acl_entry_link *nextp;
172 struct new_acl_entry{
173 unsigned short ace_len;
174 unsigned short ace_type;
175 unsigned int ace_access;
176 struct ace_id ace_id[1];
179 #define SMB_ACL_ENTRY_T struct new_acl_entry*
180 #define SMB_ACL_T struct acl_entry_link*
182 #define SMB_ACL_TAG_T unsigned short
183 #define SMB_ACL_TYPE_T int
184 #define SMB_ACL_PERM_T uint
185 #define SMB_ACL_READ S_IRUSR
186 #define SMB_ACL_WRITE S_IWUSR
187 #define SMB_ACL_EXECUTE S_IXUSR
190 #define SMB_ACL_USER ACEID_USER
191 #define SMB_ACL_USER_OBJ 3
192 #define SMB_ACL_GROUP ACEID_GROUP
193 #define SMB_ACL_GROUP_OBJ 4
194 #define SMB_ACL_OTHER 5
195 #define SMB_ACL_MASK 6
198 #define SMB_ACL_FIRST_ENTRY 1
199 #define SMB_ACL_NEXT_ENTRY 2
201 #define SMB_ACL_TYPE_ACCESS 0
202 #define SMB_ACL_TYPE_DEFAULT 1
206 /* No ACLS - fake it. */
207 #define SMB_ACL_TAG_T int
208 #define SMB_ACL_TYPE_T int
209 #define SMB_ACL_PERMSET_T mode_t
210 #define SMB_ACL_PERM_T mode_t
211 #define SMB_ACL_READ S_IRUSR
212 #define SMB_ACL_WRITE S_IWUSR
213 #define SMB_ACL_EXECUTE S_IXUSR
216 #define SMB_ACL_USER 0
217 #define SMB_ACL_USER_OBJ 1
218 #define SMB_ACL_GROUP 2
219 #define SMB_ACL_GROUP_OBJ 3
220 #define SMB_ACL_OTHER 4
221 #define SMB_ACL_MASK 5
223 typedef struct SMB_ACL_T {
227 typedef struct SMB_ACL_ENTRY_T {
231 #define SMB_ACL_FIRST_ENTRY 0
232 #define SMB_ACL_NEXT_ENTRY 1
234 #define SMB_ACL_TYPE_ACCESS 0
235 #define SMB_ACL_TYPE_DEFAULT 1
237 #endif /* No ACLs. */
238 #endif /* _SMB_ACLS_H */