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-2014 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 #ifndef _GL_INLINE_HEADER_BEGIN
66 #error "Please include config.h first."
68 _GL_INLINE_HEADER_BEGIN
69 #ifndef ACL_INTERNAL_INLINE
70 # define ACL_INTERNAL_INLINE _GL_INLINE
75 # if HAVE_ACL_GET_FILE
76 /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
77 /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
79 # ifndef MIN_ACL_ENTRIES
80 # define MIN_ACL_ENTRIES 4
83 /* POSIX 1003.1e (draft 17) */
84 # ifdef HAVE_ACL_GET_FD
85 /* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument
87 # if HAVE_ACL_FREE_TEXT /* OSF/1 */
88 ACL_INTERNAL_INLINE acl_t
89 rpl_acl_get_fd (int fd)
91 return acl_get_fd (fd, ACL_TYPE_ACCESS);
94 # define acl_get_fd rpl_acl_get_fd
97 # define HAVE_ACL_GET_FD false
99 # define acl_get_fd(fd) (NULL)
102 /* POSIX 1003.1e (draft 17) */
103 # ifdef HAVE_ACL_SET_FD
104 /* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument
106 # if HAVE_ACL_FREE_TEXT /* OSF/1 */
107 ACL_INTERNAL_INLINE int
108 rpl_acl_set_fd (int fd, acl_t acl)
110 return acl_set_fd (fd, ACL_TYPE_ACCESS, acl);
113 # define acl_set_fd rpl_acl_set_fd
116 # define HAVE_ACL_SET_FD false
118 # define acl_set_fd(fd, acl) (-1)
121 /* POSIX 1003.1e (draft 13) */
122 # if ! HAVE_ACL_FREE_TEXT
123 # define acl_free_text(buf) acl_free (buf)
127 # ifndef HAVE_ACL_EXTENDED_FILE
128 # define HAVE_ACL_EXTENDED_FILE false
129 # define acl_extended_file(name) (-1)
133 # ifndef HAVE_ACL_FROM_MODE
134 # define HAVE_ACL_FROM_MODE false
135 # define acl_from_mode(mode) (NULL)
138 /* Set to 1 if a file's mode is implicit by the ACL.
139 Set to 0 if a file's mode is stored independently from the ACL. */
140 # if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* Mac OS X, IRIX */
141 # define MODE_INSIDE_ACL 0
143 # define MODE_INSIDE_ACL 1
146 /* Return the number of entries in ACL.
147 Return -1 and set errno upon failure to determine it. */
148 /* Define a replacement for acl_entries if needed. (Only Linux has it.) */
149 # if !HAVE_ACL_ENTRIES
150 # define acl_entries rpl_acl_entries
151 extern int acl_entries (acl_t);
154 # if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
155 /* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
156 Return 1 if the given ACL is non-trivial.
157 Return 0 if it is trivial. */
158 extern int acl_extended_nontrivial (acl_t);
160 /* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
161 Return 1 if the given ACL is non-trivial.
162 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
163 Return -1 and set errno upon failure to determine it. */
164 extern int acl_access_nontrivial (acl_t);
167 # elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
169 /* Set to 1 if a file's mode is implicit by the ACL.
170 Set to 0 if a file's mode is stored independently from the ACL. */
171 # if defined __CYGWIN__ /* Cygwin */
172 # define MODE_INSIDE_ACL 0
174 # define MODE_INSIDE_ACL 1
177 /* Return 1 if the given ACL is non-trivial.
178 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
179 extern int acl_nontrivial (int count, aclent_t *entries);
181 # ifdef ACE_GETACL /* Solaris 10 */
183 /* Test an ACL retrieved with ACE_GETACL.
184 Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
185 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
186 extern int acl_ace_nontrivial (int count, ace_t *entries);
188 /* Definitions for when the built executable is executed on Solaris 10
189 (newer version) or Solaris 11. */
193 # define NEW_ACE_ACCESS_ALLOWED_ACE_TYPE 0 /* replaces ALLOW */
194 # define NEW_ACE_ACCESS_DENIED_ACE_TYPE 1 /* replaces DENY */
196 # define OLD_ACE_OWNER 0x0100
197 # define OLD_ACE_GROUP 0x0200
198 # define OLD_ACE_OTHER 0x0400
199 # define NEW_ACE_OWNER 0x1000
200 # define NEW_ACE_GROUP 0x2000
201 # define NEW_ACE_IDENTIFIER_GROUP 0x0040
202 # define NEW_ACE_EVERYONE 0x4000
203 /* For a_access_mask. */
204 # define NEW_ACE_READ_DATA 0x001 /* corresponds to 'r' */
205 # define NEW_ACE_WRITE_DATA 0x002 /* corresponds to 'w' */
206 # define NEW_ACE_APPEND_DATA 0x004
207 # define NEW_ACE_READ_NAMED_ATTRS 0x008
208 # define NEW_ACE_WRITE_NAMED_ATTRS 0x010
209 # define NEW_ACE_EXECUTE 0x020
210 # define NEW_ACE_DELETE_CHILD 0x040
211 # define NEW_ACE_READ_ATTRIBUTES 0x080
212 # define NEW_ACE_WRITE_ATTRIBUTES 0x100
213 # define NEW_ACE_DELETE 0x10000
214 # define NEW_ACE_READ_ACL 0x20000
215 # define NEW_ACE_WRITE_ACL 0x40000
216 # define NEW_ACE_WRITE_OWNER 0x80000
217 # define NEW_ACE_SYNCHRONIZE 0x100000
221 # elif HAVE_GETACL /* HP-UX */
223 /* Return 1 if the given ACL is non-trivial.
224 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
225 extern int acl_nontrivial (int count, struct acl_entry *entries, struct stat *sb);
227 # if HAVE_ACLV_H /* HP-UX >= 11.11 */
229 /* Return 1 if the given ACL is non-trivial.
230 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
231 extern int aclv_nontrivial (int count, struct acl *entries);
235 # elif HAVE_ACLX_GET && 0 /* AIX */
239 # elif HAVE_STATACL /* older AIX */
241 /* Return 1 if the given ACL is non-trivial.
242 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
243 extern int acl_nontrivial (struct acl *a);
245 # elif HAVE_ACLSORT /* NonStop Kernel */
247 /* Return 1 if the given ACL is non-trivial.
248 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
249 extern int acl_nontrivial (int count, struct acl *entries);
255 _GL_INLINE_HEADER_END