1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Internal implementation of access control lists.
5 Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
20 Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */
27 /* All systems define the ACL related API in <sys/acl.h>. */
31 #if defined HAVE_FACL && ! defined GETACLCNT && defined ACL_CNT
32 # define GETACLCNT ACL_CNT
35 /* On Linux, additional ACL related API is available in <acl/libacl.h>. */
36 #ifdef HAVE_ACL_LIBACL_H
37 # include <acl/libacl.h>
40 /* On HP-UX >= 11.11, additional ACL API is available in <aclv.h>. */
42 # include <sys/types.h>
44 /* HP-UX 11.11 lacks these declarations. */
45 extern int acl (char *, int, int, struct acl *);
46 extern int aclsort (int, int, struct acl *);
53 # define MIN(a,b) ((a) < (b) ? (a) : (b))
57 # define SIZE_MAX ((size_t) -1)
61 # define HAVE_FCHMOD false
62 # define fchmod(fd, mode) (-1)
65 _GL_INLINE_HEADER_BEGIN
66 #ifndef ACL_INTERNAL_INLINE
67 # define ACL_INTERNAL_INLINE _GL_INLINE
72 # if HAVE_ACL_GET_FILE
73 /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
74 /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
76 # ifndef MIN_ACL_ENTRIES
77 # define MIN_ACL_ENTRIES 4
80 /* POSIX 1003.1e (draft 17) */
81 # ifdef HAVE_ACL_GET_FD
82 /* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument
84 # if HAVE_ACL_FREE_TEXT /* OSF/1 */
85 ACL_INTERNAL_INLINE acl_t
86 rpl_acl_get_fd (int fd)
88 return acl_get_fd (fd, ACL_TYPE_ACCESS);
91 # define acl_get_fd rpl_acl_get_fd
94 # define HAVE_ACL_GET_FD false
96 # define acl_get_fd(fd) (NULL)
99 /* POSIX 1003.1e (draft 17) */
100 # ifdef HAVE_ACL_SET_FD
101 /* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument
103 # if HAVE_ACL_FREE_TEXT /* OSF/1 */
104 ACL_INTERNAL_INLINE int
105 rpl_acl_set_fd (int fd, acl_t acl)
107 return acl_set_fd (fd, ACL_TYPE_ACCESS, acl);
110 # define acl_set_fd rpl_acl_set_fd
113 # define HAVE_ACL_SET_FD false
115 # define acl_set_fd(fd, acl) (-1)
118 /* POSIX 1003.1e (draft 13) */
119 # if ! HAVE_ACL_FREE_TEXT
120 # define acl_free_text(buf) acl_free (buf)
124 # ifndef HAVE_ACL_EXTENDED_FILE
125 # define HAVE_ACL_EXTENDED_FILE false
126 # define acl_extended_file(name) (-1)
130 # ifndef HAVE_ACL_FROM_MODE
131 # define HAVE_ACL_FROM_MODE false
132 # define acl_from_mode(mode) (NULL)
135 /* Set to 1 if a file's mode is implicit by the ACL.
136 Set to 0 if a file's mode is stored independently from the ACL. */
137 # if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* Mac OS X, IRIX */
138 # define MODE_INSIDE_ACL 0
140 # define MODE_INSIDE_ACL 1
143 /* Return the number of entries in ACL.
144 Return -1 and set errno upon failure to determine it. */
145 /* Define a replacement for acl_entries if needed. (Only Linux has it.) */
146 # if !HAVE_ACL_ENTRIES
147 # define acl_entries rpl_acl_entries
148 extern int acl_entries (acl_t);
151 # if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
152 /* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
153 Return 1 if the given ACL is non-trivial.
154 Return 0 if it is trivial. */
155 extern int acl_extended_nontrivial (acl_t);
157 /* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
158 Return 1 if the given ACL is non-trivial.
159 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
160 Return -1 and set errno upon failure to determine it. */
161 extern int acl_access_nontrivial (acl_t);
164 # elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
166 /* Set to 1 if a file's mode is implicit by the ACL.
167 Set to 0 if a file's mode is stored independently from the ACL. */
168 # if defined __CYGWIN__ /* Cygwin */
169 # define MODE_INSIDE_ACL 0
171 # define MODE_INSIDE_ACL 1
174 /* Return 1 if the given ACL is non-trivial.
175 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
176 extern int acl_nontrivial (int count, aclent_t *entries);
178 # ifdef ACE_GETACL /* Solaris 10 */
180 /* Test an ACL retrieved with ACE_GETACL.
181 Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
182 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
183 extern int acl_ace_nontrivial (int count, ace_t *entries);
185 /* Definitions for when the built executable is executed on Solaris 10
186 (newer version) or Solaris 11. */
190 # define NEW_ACE_ACCESS_ALLOWED_ACE_TYPE 0 /* replaces ALLOW */
191 # define NEW_ACE_ACCESS_DENIED_ACE_TYPE 1 /* replaces DENY */
193 # define OLD_ACE_OWNER 0x0100
194 # define OLD_ACE_GROUP 0x0200
195 # define OLD_ACE_OTHER 0x0400
196 # define NEW_ACE_OWNER 0x1000
197 # define NEW_ACE_GROUP 0x2000
198 # define NEW_ACE_IDENTIFIER_GROUP 0x0040
199 # define NEW_ACE_EVERYONE 0x4000
200 /* For a_access_mask. */
201 # define NEW_ACE_READ_DATA 0x001 /* corresponds to 'r' */
202 # define NEW_ACE_WRITE_DATA 0x002 /* corresponds to 'w' */
203 # define NEW_ACE_APPEND_DATA 0x004
204 # define NEW_ACE_READ_NAMED_ATTRS 0x008
205 # define NEW_ACE_WRITE_NAMED_ATTRS 0x010
206 # define NEW_ACE_EXECUTE 0x020
207 # define NEW_ACE_DELETE_CHILD 0x040
208 # define NEW_ACE_READ_ATTRIBUTES 0x080
209 # define NEW_ACE_WRITE_ATTRIBUTES 0x100
210 # define NEW_ACE_DELETE 0x10000
211 # define NEW_ACE_READ_ACL 0x20000
212 # define NEW_ACE_WRITE_ACL 0x40000
213 # define NEW_ACE_WRITE_OWNER 0x80000
214 # define NEW_ACE_SYNCHRONIZE 0x100000
218 # elif HAVE_GETACL /* HP-UX */
220 /* Return 1 if the given ACL is non-trivial.
221 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
222 extern int acl_nontrivial (int count, struct acl_entry *entries, struct stat *sb);
224 # if HAVE_ACLV_H /* HP-UX >= 11.11 */
226 /* Return 1 if the given ACL is non-trivial.
227 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
228 extern int aclv_nontrivial (int count, struct acl *entries);
232 # elif HAVE_ACLX_GET && 0 /* AIX */
236 # elif HAVE_STATACL /* older AIX */
238 /* Return 1 if the given ACL is non-trivial.
239 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
240 extern int acl_nontrivial (struct acl *a);
242 # elif HAVE_ACLSORT /* NonStop Kernel */
244 /* Return 1 if the given ACL is non-trivial.
245 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
246 extern int acl_nontrivial (int count, struct acl *entries);
252 _GL_INLINE_HEADER_END