Mercurial > hg > octave-nkf > gnulib-hg
annotate lib/acl-internal.h @ 10158:73042342e7f6
New function for testing triviality of ACL with POSIX-draft like API.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 04 Jun 2008 22:48:48 +0200 (2008-06-04) |
parents | cbc922dd9819 |
children | caed32fb1892 |
rev | line source |
---|---|
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
1 /* Internal implementation of access control lists. |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
2 |
10109
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
3 Copyright (C) 2002-2003, 2005-2008 Free Software Foundation, Inc. |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
4 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8583
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
6 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8583
diff
changeset
|
7 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8583
diff
changeset
|
8 (at your option) any later version. |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
9 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
13 GNU General Public License for more details. |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
14 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
15 You should have received a copy of the GNU General Public License |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8583
diff
changeset
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>. |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
17 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
18 Written by Paul Eggert and Andreas Gruenbacher. */ |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
19 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
20 #include "acl.h" |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
21 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
22 #include <stdbool.h> |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
23 #include <stdlib.h> |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
24 |
10109
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
25 /* All systems define the ACL related API in <sys/acl.h>. */ |
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
26 #if HAVE_SYS_ACL_H |
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
27 # include <sys/acl.h> |
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
28 #endif |
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
29 #if defined HAVE_ACL && ! defined GETACLCNT && defined ACL_CNT |
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
30 # define GETACLCNT ACL_CNT |
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
31 #endif |
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
32 |
29794e333189
Move some declarations from acl.h to acl-internal.h.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
33 /* On Linux, additional ACL related API is available in <acl/libacl.h>. */ |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
34 #ifdef HAVE_ACL_LIBACL_H |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
35 # include <acl/libacl.h> |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
36 #endif |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
37 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
38 #include "error.h" |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
39 #include "quote.h" |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
40 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
41 #include <errno.h> |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
42 #ifndef ENOSYS |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
43 # define ENOSYS (-1) |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
44 #endif |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
45 #ifndef ENOTSUP |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
46 # define ENOTSUP (-1) |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
47 #endif |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
48 |
8479
19b8b337ecaa
Suggestions by Bruno Haible:
Paul Eggert <eggert@cs.ucla.edu>
parents:
8476
diff
changeset
|
49 #include "gettext.h" |
19b8b337ecaa
Suggestions by Bruno Haible:
Paul Eggert <eggert@cs.ucla.edu>
parents:
8476
diff
changeset
|
50 #define _(msgid) gettext (msgid) |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
51 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
52 #ifndef HAVE_FCHMOD |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
53 # define HAVE_FCHMOD false |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
54 # define fchmod(fd, mode) (-1) |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
55 #endif |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
56 |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
57 |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
58 #if USE_ACL |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
59 |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
60 # if HAVE_ACL_GET_FILE |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
61 /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */ |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
62 /* Linux, FreeBSD, MacOS X, IRIX, Tru64 */ |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
63 |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
64 # ifndef MIN_ACL_ENTRIES |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
65 # define MIN_ACL_ENTRIES 4 |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
66 # endif |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
67 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
68 /* POSIX 1003.1e (draft 17) */ |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
69 # ifdef HAVE_ACL_GET_FD |
10115
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
70 /* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
71 macro(!). */ |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
72 # if HAVE_ACL_FREE_TEXT /* OSF/1 */ |
10115
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
73 static inline acl_t |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
74 rpl_acl_get_fd (int fd) |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
75 { |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
76 return acl_get_fd (fd, ACL_TYPE_ACCESS); |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
77 } |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
78 # undef acl_get_fd |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
79 # define acl_get_fd rpl_acl_get_fd |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
80 # endif |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
81 # else |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
82 # define HAVE_ACL_GET_FD false |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
83 # undef acl_get_fd |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
84 # define acl_get_fd(fd) (NULL) |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
85 # endif |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
86 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
87 /* POSIX 1003.1e (draft 17) */ |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
88 # ifdef HAVE_ACL_SET_FD |
10115
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
89 /* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
90 macro(!). */ |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
91 # if HAVE_ACL_FREE_TEXT /* OSF/1 */ |
10115
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
92 static inline int |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
93 rpl_acl_set_fd (int fd, acl_t acl) |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
94 { |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
95 return acl_set_fd (fd, ACL_TYPE_ACCESS, acl); |
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
96 } |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
97 # undef acl_set_fd |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
98 # define acl_set_fd rpl_acl_set_fd |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
99 # endif |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
100 # else |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
101 # define HAVE_ACL_SET_FD false |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
102 # undef acl_set_fd |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
103 # define acl_set_fd(fd, acl) (-1) |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
104 # endif |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
105 |
10115
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
106 /* POSIX 1003.1e (draft 13) */ |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
107 # if ! HAVE_ACL_FREE_TEXT |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
108 # define acl_free_text(buf) acl_free (buf) |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
109 # endif |
10115
4e8f2032eb4d
Add support for ACLs on OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
10114
diff
changeset
|
110 |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
111 /* Linux-specific */ |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
112 # ifndef HAVE_ACL_EXTENDED_FILE |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
113 # define HAVE_ACL_EXTENDED_FILE false |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
114 # define acl_extended_file(name) (-1) |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
115 # endif |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
116 |
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
117 /* Linux-specific */ |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
118 # ifndef HAVE_ACL_FROM_MODE |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
119 # define HAVE_ACL_FROM_MODE false |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
120 # define acl_from_mode(mode) (NULL) |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
121 # endif |
8476
2798cb65bd90
Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
122 |
10114
51164d97e89b
Make copy_acl work on MacOS X 10.5.
Bruno Haible <bruno@clisp.org>
parents:
10109
diff
changeset
|
123 /* Set to 1 if a file's mode is implicit by the ACL. |
51164d97e89b
Make copy_acl work on MacOS X 10.5.
Bruno Haible <bruno@clisp.org>
parents:
10109
diff
changeset
|
124 Set to 0 if a file's mode is stored independently from the ACL. */ |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
125 # if HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP /* MacOS X */ |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
126 # define MODE_INSIDE_ACL 0 |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
127 # else |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
128 # define MODE_INSIDE_ACL 1 |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
129 # endif |
10114
51164d97e89b
Make copy_acl work on MacOS X 10.5.
Bruno Haible <bruno@clisp.org>
parents:
10109
diff
changeset
|
130 |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
131 # if defined __APPLE__ && defined __MACH__ /* MacOS X */ |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
132 # define ACL_NOT_WELL_SUPPORTED(Err) \ |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
133 ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == ENOENT) |
10153 | 134 # elif defined EOPNOTSUPP /* Tru64 NFS */ |
135 # define ACL_NOT_WELL_SUPPORTED(Err) \ | |
136 ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == EOPNOTSUPP) | |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
137 # else |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
138 # define ACL_NOT_WELL_SUPPORTED(Err) \ |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
139 ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY) |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
140 # endif |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
141 |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
142 /* Define a replacement for acl_entries if needed. (Only Linux has it.) */ |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
143 # if !HAVE_ACL_ENTRIES |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
144 # define acl_entries rpl_acl_entries |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
145 extern int acl_entries (acl_t); |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
146 # endif |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
147 |
10158
73042342e7f6
New function for testing triviality of ACL with POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10153
diff
changeset
|
148 /* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS. |
73042342e7f6
New function for testing triviality of ACL with POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10153
diff
changeset
|
149 Return 1 if the given ACL is non-trivial. |
73042342e7f6
New function for testing triviality of ACL with POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10153
diff
changeset
|
150 Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. |
73042342e7f6
New function for testing triviality of ACL with POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10153
diff
changeset
|
151 Return -1 and set errno upon failure to determine it. */ |
73042342e7f6
New function for testing triviality of ACL with POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10153
diff
changeset
|
152 extern int acl_access_nontrivial (acl_t); |
73042342e7f6
New function for testing triviality of ACL with POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10153
diff
changeset
|
153 |
10151
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
154 # endif |
437808f00003
Enclose definitions in #if for POSIX-draft like API.
Bruno Haible <bruno@clisp.org>
parents:
10115
diff
changeset
|
155 |
10114
51164d97e89b
Make copy_acl work on MacOS X 10.5.
Bruno Haible <bruno@clisp.org>
parents:
10109
diff
changeset
|
156 #endif |