- sorry, forgot to check a pointer
[Samba.git] / source / include / smb_acls.h
blobbea90bf46a0262a2c6335ceea6bfb643f446dad7
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 #elif defined(HAVE_AIX_ACLS)
129 /* Donated by Medha Date, mdate@austin.ibm.com, for IBM */
131 #include "/usr/include/acl.h"
133 typedef uint *SMB_ACL_PERMSET_T;
135 struct acl_entry_link{
136 struct acl_entry_link *prevp;
137 struct new_acl_entry *entryp;
138 struct acl_entry_link *nextp;
139 int count;
142 struct new_acl_entry{
143 unsigned short ace_len;
144 unsigned short ace_type;
145 unsigned int ace_access;
146 struct ace_id ace_id[1];
149 #define SMB_ACL_ENTRY_T struct new_acl_entry*
150 #define SMB_ACL_T struct acl_entry_link*
152 #define SMB_ACL_TAG_T unsigned short
153 #define SMB_ACL_TYPE_T int
154 #define SMB_ACL_PERM_T uint
155 #define SMB_ACL_READ S_IRUSR
156 #define SMB_ACL_WRITE S_IWUSR
157 #define SMB_ACL_EXECUTE S_IXUSR
159 /* Types of ACLs. */
160 #define SMB_ACL_USER ACEID_USER
161 #define SMB_ACL_USER_OBJ 3
162 #define SMB_ACL_GROUP ACEID_GROUP
163 #define SMB_ACL_GROUP_OBJ 4
164 #define SMB_ACL_OTHER 5
165 #define SMB_ACL_MASK 6
168 #define SMB_ACL_FIRST_ENTRY 1
169 #define SMB_ACL_NEXT_ENTRY 2
171 #define SMB_ACL_TYPE_ACCESS 0
172 #define SMB_ACL_TYPE_DEFAULT 1
174 #else /* No ACLs. */
176 /* No ACLS - fake it. */
177 #define SMB_ACL_TAG_T int
178 #define SMB_ACL_TYPE_T int
179 #define SMB_ACL_PERMSET_T mode_t
180 #define SMB_ACL_PERM_T mode_t
181 #define SMB_ACL_READ S_IRUSR
182 #define SMB_ACL_WRITE S_IWUSR
183 #define SMB_ACL_EXECUTE S_IXUSR
185 /* Types of ACLs. */
186 #define SMB_ACL_USER 0
187 #define SMB_ACL_USER_OBJ 1
188 #define SMB_ACL_GROUP 2
189 #define SMB_ACL_GROUP_OBJ 3
190 #define SMB_ACL_OTHER 4
191 #define SMB_ACL_MASK 5
193 typedef struct SMB_ACL_T {
194 int dummy;
195 } *SMB_ACL_T;
197 typedef struct SMB_ACL_ENTRY_T {
198 int dummy;
199 } *SMB_ACL_ENTRY_T;
201 #define SMB_ACL_FIRST_ENTRY 0
202 #define SMB_ACL_NEXT_ENTRY 1
204 #define SMB_ACL_TYPE_ACCESS 0
205 #define SMB_ACL_TYPE_DEFAULT 1
207 #endif /* No ACLs. */
208 #endif /* _SMB_ACLS_H */