]>
git.saurik.com Git - apple/libc.git/blob - posix1e/aclvar.h
2 * Copyright (c) 2004 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>
28 #define _ACL_HEADER_SIZE sizeof(struct kauth_filesec)
29 #define _ACL_ENTRY_SIZE sizeof(struct kauth_ace)
32 * Internal access control list entry representation.
36 #define _ACL_ENTRY_MAGIC 0xac1ac101
44 * Internal representation of an ACL.
45 * XXX static allocation is wasteful.
49 #define _ACL_ACL_MAGIC 0xac1ac102
53 struct _acl_entry a_ace
[ACL_MAX_ENTRIES
];
64 * ACL entry permissions.
71 * Argument validation.
74 #define _ACL_VALID_ENTRY(_e) ((_e)->ae_magic == _ACL_ENTRY_MAGIC)
76 #define _ACL_VALID_ACL(_a) ((_a)->a_magic == _ACL_ACL_MAGIC)
78 #define _ACL_ENTRY_CONTAINED(_a, _e) \
79 ((_e) >= &(_a)->a_ace[0]) && ((_e) < &(_a)->a_ace[ACL_MAX_ENTRIES])
81 #define _ACL_VALID_FLAG(_f) (((_f) & _ACL_FLAGS_MASK) == (_f))
83 #define _ACL_VALID_ENTRY_FLAG(_f) (((_f) & _ACL_ENTRY_FLAGS_MASK) == (_f))
85 #define _ACL_PERMS_MASK (ACL_READ_DATA | \
86 ACL_LIST_DIRECTORY | \
93 ACL_ADD_SUBDIRECTORY | \
95 ACL_READ_ATTRIBUTES | \
96 ACL_WRITE_ATTRIBUTES | \
97 ACL_READ_EXTATTRIBUTES | \
98 ACL_WRITE_EXTATTRIBUTES | \
100 ACL_WRITE_SECURITY | \
103 #define _ACL_VALID_PERM(_f) (((_f) & ~_ACL_PERMS_MASK) == 0)
105 #define _ACL_VALIDATE_ACL(_a) \
107 if (!_ACL_VALID_ACL((_a))) { \
113 #define _ACL_VALIDATE_ENTRY(_e) \
115 if (!_ACL_VALID_ENTRY((_e))) { \
121 #define _ACL_VALIDATE_ENTRY_CONTAINED(_a, _e) \
123 if (!_ACL_ENTRY_CONTAINED((_a), (_e))) { \
129 #define _ACL_VALIDATE_FLAG(_f) \
131 if (!_ACL_VALID_FLAG((_f))) { \
137 #define _ACL_VALIDATE_ENTRY_FLAG(_f) \
139 if (!_ACL_VALID_ENTRY_FLAG((_f))) { \
145 #define _ACL_VALIDATE_PERM(_f) \
147 if (!_ACL_VALID_PERM((_f))) { \
153 #endif /* _ACLVAR_H */