]>
git.saurik.com Git - apple/libc.git/blob - posix1e/aclvar.h
2 * Copyright (c) 2004, 2008 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 #include <sys/kauth.h>
29 * Internal access control list entry representation.
33 #define _ACL_ENTRY_MAGIC 0xac1ac101
41 * Internal representation of an ACL.
42 * XXX static allocation is wasteful.
46 #define _ACL_ACL_MAGIC 0xac1ac102
50 struct _acl_entry a_ace
[ACL_MAX_ENTRIES
];
61 * ACL entry permissions.
68 * Argument validation.
71 #define _ACL_VALID_ENTRY(_e) ((_e)->ae_magic == _ACL_ENTRY_MAGIC)
73 #define _ACL_VALID_ACL(_a) ((_a)->a_magic == _ACL_ACL_MAGIC)
75 #define _ACL_ENTRY_CONTAINED(_a, _e) \
76 ((_e) >= &(_a)->a_ace[0]) && ((_e) < &(_a)->a_ace[ACL_MAX_ENTRIES])
78 #define _ACL_VALID_FLAG(_f) (((_f) & _ACL_FLAGS_MASK) == (_f))
80 #define _ACL_VALID_ENTRY_FLAG(_f) (((_f) & _ACL_ENTRY_FLAGS_MASK) == (_f))
82 #define _ACL_PERMS_MASK (ACL_READ_DATA | \
83 ACL_LIST_DIRECTORY | \
90 ACL_ADD_SUBDIRECTORY | \
92 ACL_READ_ATTRIBUTES | \
93 ACL_WRITE_ATTRIBUTES | \
94 ACL_READ_EXTATTRIBUTES | \
95 ACL_WRITE_EXTATTRIBUTES | \
97 ACL_WRITE_SECURITY | \
100 #define _ACL_VALID_PERM(_f) (((_f) & ~_ACL_PERMS_MASK) == 0)
102 #define _ACL_VALIDATE_ACL(_a) \
104 if (!_ACL_VALID_ACL((_a))) { \
110 #define _ACL_VALIDATE_ENTRY(_e) \
112 if (!_ACL_VALID_ENTRY((_e))) { \
118 #define _ACL_VALIDATE_ENTRY_CONTAINED(_a, _e) \
120 if (!_ACL_ENTRY_CONTAINED((_a), (_e))) { \
126 #define _ACL_VALIDATE_FLAG(_f) \
128 if (!_ACL_VALID_FLAG((_f))) { \
134 #define _ACL_VALIDATE_ENTRY_FLAG(_f) \
136 if (!_ACL_VALID_ENTRY_FLAG((_f))) { \
142 #define _ACL_VALIDATE_PERM(_f) \
144 if (!_ACL_VALID_PERM((_f))) { \
150 #endif /* _ACLVAR_H */