Deleted Added
full compact
acl_get.c (74191) acl_get.c (74667)
1/*-
2 * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/libc/posix1e/acl_get.c 74191 2001-03-13 02:31:32Z rwatson $
26 * $FreeBSD: head/lib/libc/posix1e/acl_get.c 74667 2001-03-22 22:31:01Z jedgar $
27 */
28/*
29 * acl_get_file - syscall wrapper for retrieving ACL by filename
30 * acl_get_fd - syscall wrapper for retrieving access ACL by fd
31 * acl_get_fd_np - syscall wrapper for retrieving ACL by fd (non-POSIX)
27 */
28/*
29 * acl_get_file - syscall wrapper for retrieving ACL by filename
30 * acl_get_fd - syscall wrapper for retrieving access ACL by fd
31 * acl_get_fd_np - syscall wrapper for retrieving ACL by fd (non-POSIX)
32 * acl_get_permset() returns the permission set in the ACL entry
33 * acl_get_qualifier() retrieves the qualifier of the tag from the ACL entry
34 * acl_get_tag_type() returns the tag type for the ACL entry entry_d
32 */
33
34#include <sys/types.h>
35#include <sys/acl.h>
35 */
36
37#include <sys/types.h>
38#include <sys/acl.h>
36#include <sys/errno.h>
39
40#include <errno.h>
37#include <stdlib.h>
41#include <stdlib.h>
42#include <string.h>
38
39acl_t
40acl_get_file(const char *path_p, acl_type_t type)
41{
42 struct acl *aclp;
43 int error;
44
45 aclp = acl_init(ACL_MAX_ENTRIES);

--- 44 unchanged lines hidden (view full) ---

90 error = __acl_get_fd(fd, type, aclp);
91 if (error) {
92 acl_free(aclp);
93 return (NULL);
94 }
95
96 return (aclp);
97}
43
44acl_t
45acl_get_file(const char *path_p, acl_type_t type)
46{
47 struct acl *aclp;
48 int error;
49
50 aclp = acl_init(ACL_MAX_ENTRIES);

--- 44 unchanged lines hidden (view full) ---

95 error = __acl_get_fd(fd, type, aclp);
96 if (error) {
97 acl_free(aclp);
98 return (NULL);
99 }
100
101 return (aclp);
102}
103
104int
105acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p)
106{
107
108 if (!entry_d || !permset_p) {
109 errno = EINVAL;
110 return -1;
111 }
112
113 *permset_p = &entry_d->ae_perm;
114
115 return 0;
116}
117
118void *
119acl_get_qualifier(acl_entry_t entry_d)
120{
121 uid_t *retval;
122
123 if (!entry_d) {
124 errno = EINVAL;
125 return NULL;
126 }
127
128 switch(entry_d->ae_tag) {
129 case ACL_USER:
130 case ACL_GROUP:
131 retval = malloc(sizeof(uid_t));
132 if (retval) {
133 *retval = entry_d->ae_id;
134 return retval;
135 }
136 }
137
138 errno = EINVAL;
139 return NULL;
140}
141
142int
143acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p)
144{
145
146 if (!entry_d || !tag_type_p) {
147 errno = EINVAL;
148 return -1;
149 }
150
151 *tag_type_p = entry_d->ae_tag;
152
153 return 0;
154}