aboutsummaryrefslogtreecommitdiffstats
path: root/lib/acl-internal.h
diff options
context:
space:
mode:
authorPaul Eggert2015-05-27 17:46:15 -0700
committerPaul Eggert2015-05-27 17:55:06 -0700
commit6c52e9b93b68795d1876718d8f3c1d57bf7f6d91 (patch)
treeb2d93b1121c05cfffa59df9325139cdf56eed6c0 /lib/acl-internal.h
parentcc41938ae0f5694d657f360f19dd9ac166271db2 (diff)
downloademacs-6c52e9b93b68795d1876718d8f3c1d57bf7f6d91.tar.gz
emacs-6c52e9b93b68795d1876718d8f3c1d57bf7f6d91.zip
Merge from gnulib
This incorporates: 2015-05-27 qacl: Reimplement qset_acl and qcopy_acl (Bug#20666) 2015-05-27 file-has-acl: Split feature tests again (Bug#20667) 2015-05-27 string: fix build failure on BSD/OSX with FORTIFY_SOURCE 2015-05-26 stdio: limit __gnu_printf__ witness to gcc 4.4+ 2015-05-26 inttypes: force correct mingw PRIdMAX even without <stdio.h> 2015-05-26 stdio: fix probe on mingw under gcc 5.1 * admin/merge-gnulib (GNULIB_MODULES): Replace qacl with qcopy-acl, since we don't need the rest of qacl. * doc/misc/texinfo.tex, lib/acl-internal.c, lib/acl-internal.h: * lib/inttypes.in.h, lib/qcopy-acl.c, lib/qset-acl.c: * lib/string.in.h, m4/acl.m4, m4/stdio_h.m4: Get latest versions from gnulib. * lib/get-permissions.c, lib/set-permissions.c: New files. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * nt/gnulib.mk: Merge lib/gnulib.mk changes by hand.
Diffstat (limited to 'lib/acl-internal.h')
-rw-r--r--lib/acl-internal.h57
1 files changed, 49 insertions, 8 deletions
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 9b9fae2e9e0..11fdea14042 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -133,12 +133,9 @@ rpl_acl_set_fd (int fd, acl_t acl)
133# define acl_from_mode(mode) (NULL) 133# define acl_from_mode(mode) (NULL)
134# endif 134# endif
135 135
136/* 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 Set to 0 if a file's mode is stored independently from the ACL. */
138# if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* Mac OS X, IRIX */ 137# if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* Mac OS X, IRIX */
139# define MODE_INSIDE_ACL 0 138# define MODE_INSIDE_ACL 0
140# else
141# define MODE_INSIDE_ACL 1
142# endif 139# endif
143 140
144/* Return the number of entries in ACL. 141/* Return the number of entries in ACL.
@@ -164,12 +161,9 @@ extern int acl_access_nontrivial (acl_t);
164 161
165# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */ 162# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
166 163
167/* Set to 1 if a file's mode is implicit by the ACL. 164/* Set to 0 if a file's mode is stored independently from the ACL. */
168 Set to 0 if a file's mode is stored independently from the ACL. */
169# if defined __CYGWIN__ /* Cygwin */ 165# if defined __CYGWIN__ /* Cygwin */
170# define MODE_INSIDE_ACL 0 166# define MODE_INSIDE_ACL 0
171# else /* Solaris */
172# define MODE_INSIDE_ACL 1
173# endif 167# endif
174 168
175/* Return 1 if the given ACL is non-trivial. 169/* Return 1 if the given ACL is non-trivial.
@@ -248,6 +242,53 @@ extern int acl_nontrivial (int count, struct acl *entries);
248 242
249# endif 243# endif
250 244
245/* Set to 1 if a file's mode is implicit by the ACL. */
246# ifndef MODE_INSIDE_ACL
247# define MODE_INSIDE_ACL 1
248# endif
249
251#endif 250#endif
252 251
252struct permission_context {
253 mode_t mode;
254#ifdef USE_ACL
255# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
256 acl_t acl;
257# if !HAVE_ACL_TYPE_EXTENDED
258 acl_t default_acl;
259# endif
260 bool acls_not_supported;
261
262# elif defined GETACL /* Solaris, Cygwin */
263 int count;
264 aclent_t *entries;
265# ifdef ACE_GETACL
266 int ace_count;
267 ace_t *ace_entries;
268# endif
269
270# elif HAVE_GETACL /* HP-UX */
271 struct acl_entry entries[NACLENTRIES];
272 int count;
273# if HAVE_ACLV_H
274 struct acl aclv_entries[NACLVENTRIES];
275 int aclv_count;
276# endif
277
278# elif HAVE_STATACL /* older AIX */
279 union { struct acl a; char room[4096]; } u;
280 bool have_u;
281
282# elif HAVE_ACLSORT /* NonStop Kernel */
283 struct acl entries[NACLENTRIES];
284 int count;
285
286# endif
287#endif
288};
289
290int get_permissions (const char *, int, mode_t, struct permission_context *);
291int set_permissions (struct permission_context *, const char *, int);
292void free_permission_context (struct permission_context *);
293
253_GL_INLINE_HEADER_END 294_GL_INLINE_HEADER_END