Working code to read POSIX ACLs on a Linux system using the bestbits
[kai/samba.git] / source3 / include / smb_acls.h
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 #include "includes.h"
26
27 #if defined(HAVE_POSIX_ACLS)
28
29 /* This is an identity mapping (just remove the SMB_). */
30
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
38
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
46
47 #define SMB_ACL_T                                       acl_t
48
49 #define SMB_ACL_ENTRY_T                         acl_entry_t
50
51 #define SMB_ACL_FIRST_ENTRY         ACL_FIRST_ENTRY
52 #define SMB_ACL_NEXT_ENTRY          ACL_NEXT_ENTRY
53
54 #define SMB_ACL_TYPE_ACCESS         ACL_TYPE_ACCESS
55 #define SMB_ACL_TYPE_DEFAULT        ACL_TYPE_DEFAULT
56
57 #elif defined(HAVE_SOLARIS_ACLS)
58
59 #elif defined(HAVE_IRIX_ACLS)
60
61 #else /* No ACLs. */
62
63 /* No ACLS - fake it. */
64 #define SMB_ACL_TAG_T                           int
65 #define SMB_ACL_TYPE_T              int
66 #define SMB_ACL_PERMSET_T                       mode_t
67 #define SMB_ACL_PERM_T                          mode_t
68 #define SMB_ACL_READ                            S_IRUSR
69 #define SMB_ACL_WRITE                           S_IWUSR
70 #define SMB_ACL_EXECUTE                         S_IXUSR
71
72 /* Types of ACLs. */
73 #define SMB_ACL_USER                            0
74 #define SMB_ACL_USER_OBJ                        1
75 #define SMB_ACL_GROUP                           2
76 #define SMB_ACL_GROUP_OBJ                       3
77 #define SMB_ACL_OTHER                           4
78 #define SMB_ACL_MASK                            5
79
80 typedef struct SMB_ACL_T {
81         int dummy;
82 } *SMB_ACL_T;
83
84 typedef struct SMB_ACL_ENTRY_T {
85         int dummy;
86 } *SMB_ACL_ENTRY_T;
87
88 #define SMB_ACL_FIRST_ENTRY                     0
89 #define SMB_ACL_NEXT_ENTRY                      1
90
91 #define SMB_ACL_TYPE_ACCESS                     0
92 #define SMB_ACL_TYPE_DEFAULT            1
93
94 #endif /* No ACLs. */
95 #endif /* _SMB_ACLS_H */