Changed the *_abbbrevint() functions to *_varint().
[rsync/rsync.git] / smb_acls.h
CommitLineData
1c3344a1
WD
1/*
2 Unix SMB/Netbios implementation.
3 Version 2.2.x
4 Portable SMB ACL interface
5 Copyright (C) Jeremy Allison 2000
6
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.
11
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.
16
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.
20*/
21
22#ifndef _SMB_ACLS_H
23#define _SMB_ACLS_H
24
25#if defined HAVE_POSIX_ACLS
26
27/* This is an identity mapping (just remove the SMB_). */
28
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
36
37/* Types of ACLs. */
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
44
45#define SMB_ACL_T acl_t
46
47#define SMB_ACL_ENTRY_T acl_entry_t
48
49#define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY
50#define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY
51
52#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
53#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
54
55#elif defined HAVE_TRU64_ACLS
56
57/* This is for DEC/Compaq Tru64 UNIX */
58
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
66
67/* Types of ACLs. */
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
74
75#define SMB_ACL_T acl_t
76
77#define SMB_ACL_ENTRY_T acl_entry_t
78
79#define SMB_ACL_FIRST_ENTRY 0
80#define SMB_ACL_NEXT_ENTRY 1
81
82#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
83#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
84
85#elif defined HAVE_UNIXWARE_ACLS || defined HAVE_SOLARIS_ACLS
86/*
87 * Donated by Michael Davidson <md@sco.COM> for UnixWare / OpenUNIX.
88 * Modified by Toomas Soome <tsoome@ut.ee> for Solaris.
89 */
90
91/* SVR4.2 ES/MP ACLs */
92typedef int SMB_ACL_TAG_T;
93typedef int SMB_ACL_TYPE_T;
94typedef ushort *SMB_ACL_PERMSET_T;
95typedef ushort SMB_ACL_PERM_T;
96#define SMB_ACL_READ 4
97#define SMB_ACL_WRITE 2
98#define SMB_ACL_EXECUTE 1
99
100/* Types of ACLs. */
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
107
108typedef struct SMB_ACL_T {
109 int size;
110 int count;
111 int next;
112 struct acl acl[1];
113} *SMB_ACL_T;
114
115typedef struct acl *SMB_ACL_ENTRY_T;
116
117#define SMB_ACL_FIRST_ENTRY 0
118#define SMB_ACL_NEXT_ENTRY 1
119
120#define SMB_ACL_TYPE_ACCESS 0
121#define SMB_ACL_TYPE_DEFAULT 1
122
123#ifdef __CYGWIN__
124#define SMB_ACL_LOSES_SPECIAL_MODE_BITS
125#endif
126
127#elif defined HAVE_HPUX_ACLS
128
129/*
130 * Based on the Solaris & UnixWare code.
131 */
132
133#undef GROUP
134#include <sys/aclv.h>
135
136/* SVR4.2 ES/MP ACLs */
137typedef int SMB_ACL_TAG_T;
138typedef int SMB_ACL_TYPE_T;
139typedef ushort *SMB_ACL_PERMSET_T;
140typedef ushort SMB_ACL_PERM_T;
141#define SMB_ACL_READ 4
142#define SMB_ACL_WRITE 2
143#define SMB_ACL_EXECUTE 1
144
145/* Types of ACLs. */
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
152
153typedef struct SMB_ACL_T {
154 int size;
155 int count;
156 int next;
157 struct acl acl[1];
158} *SMB_ACL_T;
159
160typedef struct acl *SMB_ACL_ENTRY_T;
161
162#define SMB_ACL_FIRST_ENTRY 0
163#define SMB_ACL_NEXT_ENTRY 1
164
165#define SMB_ACL_TYPE_ACCESS 0
166#define SMB_ACL_TYPE_DEFAULT 1
167
168#elif defined HAVE_IRIX_ACLS
169
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
177
178/* Types of ACLs. */
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
185
186typedef struct SMB_ACL_T {
187 int next;
188 BOOL freeaclp;
189 struct acl *aclp;
190} *SMB_ACL_T;
191
192#define SMB_ACL_ENTRY_T acl_entry_t
193
194#define SMB_ACL_FIRST_ENTRY 0
195#define SMB_ACL_NEXT_ENTRY 1
196
197#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
198#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
199
200#elif defined HAVE_AIX_ACLS
201
202/* Donated by Medha Date, mdate@austin.ibm.com, for IBM */
203
204#include "/usr/include/acl.h"
205
206typedef uint *SMB_ACL_PERMSET_T;
207
208struct acl_entry_link{
209 struct acl_entry_link *prevp;
210 struct new_acl_entry *entryp;
211 struct acl_entry_link *nextp;
212 int count;
213};
214
215struct 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];
220};
221
222#define SMB_ACL_ENTRY_T struct new_acl_entry*
223#define SMB_ACL_T struct acl_entry_link*
224
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
231
232/* Types of ACLs. */
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
239
240
241#define SMB_ACL_FIRST_ENTRY 1
242#define SMB_ACL_NEXT_ENTRY 2
243
244#define SMB_ACL_TYPE_ACCESS 0
245#define SMB_ACL_TYPE_DEFAULT 1
246
247#else /* No ACLs. */
248
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
257
258/* Types of ACLs. */
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
265
266typedef struct SMB_ACL_T {
267 int dummy;
268} *SMB_ACL_T;
269
270typedef struct SMB_ACL_ENTRY_T {
271 int dummy;
272} *SMB_ACL_ENTRY_T;
273
274#define SMB_ACL_FIRST_ENTRY 0
275#define SMB_ACL_NEXT_ENTRY 1
276
277#define SMB_ACL_TYPE_ACCESS 0
278#define SMB_ACL_TYPE_DEFAULT 1
279
280#endif /* No ACLs. */
281#endif /* _SMB_ACLS_H */