2 * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
5 * This software was developed by Robert Watson for the TrustedBSD Project.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * acl_get_fd - syscall wrapper for retrieving access ACL by fd
30 * acl_get_fd_np - syscall wrapper for retrieving ACL by fd (non-POSIX)
31 * acl_get_file - syscall wrapper for retrieving ACL by filename
32 * acl_get_link_np - syscall wrapper for retrieving ACL by filename (NOFOLLOW)
34 * acl_get_perm_np() checks if a permission is in the specified
36 * acl_get_permset() returns the permission set in the ACL entry
37 * acl_get_qualifier() retrieves the qualifier of the tag from the ACL entry
38 * acl_get_tag_type() returns the tag type for the ACL entry entry_d
41 #include <sys/cdefs.h>
42 __FBSDID("$FreeBSD$");
44 #include <sys/types.h>
45 #include "namespace.h"
47 #include "un-namespace.h"
54 acl_get_file(const char *path_p, acl_type_t type)
59 aclp = acl_init(ACL_MAX_ENTRIES);
63 error = __acl_get_file(path_p, type, &aclp->ats_acl);
73 acl_get_link_np(const char *path_p, acl_type_t type)
78 aclp = acl_init(ACL_MAX_ENTRIES);
82 error = __acl_get_link(path_p, type, &aclp->ats_acl);
97 aclp = acl_init(ACL_MAX_ENTRIES);
101 error = ___acl_get_fd(fd, ACL_TYPE_ACCESS, &aclp->ats_acl);
111 acl_get_fd_np(int fd, acl_type_t type)
116 aclp = acl_init(ACL_MAX_ENTRIES);
120 error = ___acl_get_fd(fd, type, &aclp->ats_acl);
130 acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm)
133 if (permset_d == NULL) {
142 if (*permset_d & perm)
154 * acl_get_permset() (23.4.17): return via permset_p a descriptor to
155 * the permission set in the ACL entry entry_d.
158 acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p)
161 if (entry_d == NULL || permset_p == NULL) {
166 *permset_p = &entry_d->ae_perm;
172 * acl_get_qualifier() (23.4.18): retrieve the qualifier of the tag
173 * for the ACL entry entry_d.
176 acl_get_qualifier(acl_entry_t entry_d)
180 if (entry_d == NULL) {
185 switch(entry_d->ae_tag) {
188 retval = malloc(sizeof(uid_t));
191 *retval = entry_d->ae_id;
200 * acl_get_tag_type() (23.4.19): return the tag type for the ACL
204 acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p)
207 if (entry_d == NULL || tag_type_p == NULL) {
212 *tag_type_p = entry_d->ae_tag;