Deleted Added
full compact
acl_valid.c (56625) acl_valid.c (56760)
1/*-
2 * Copyright (c) 1999 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 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_valid.c 56625 2000-01-26 04:19:38Z rwatson $
26 * $FreeBSD: head/lib/libc/posix1e/acl_valid.c 56760 2000-01-28 20:07:00Z rwatson $
27 */
28/*
29 * acl_valid -- POSIX.1e ACL check routine
30 */
31
32#include <sys/types.h>
33#include <sys/acl.h>
34#include <sys/errno.h>
35
36#include "acl_support.h"
37
38/*
39 * acl_valid: accepts an ACL, returns 0 on valid ACL, -1 for invalid,
40 * and errno set to EINVAL.
41 *
42 * Implemented by calling the acl_check routine in acl_support, which
43 * requires ordering. We call acl_support's acl_sort to make this
27 */
28/*
29 * acl_valid -- POSIX.1e ACL check routine
30 */
31
32#include <sys/types.h>
33#include <sys/acl.h>
34#include <sys/errno.h>
35
36#include "acl_support.h"
37
38/*
39 * acl_valid: accepts an ACL, returns 0 on valid ACL, -1 for invalid,
40 * and errno set to EINVAL.
41 *
42 * Implemented by calling the acl_check routine in acl_support, which
43 * requires ordering. We call acl_support's acl_sort to make this
44 * true.
44 * true. POSIX.1e allows acl_valid() to reorder the ACL as it sees fit.
45 *
45 *
46 * POSIX.1e allows acl_valid() to reorder the ACL as it sees fit.
47 *
48 * This call is deprecated, as it doesn't ask whether the ACL is valid
46 * This call is deprecated, as it doesn't ask whether the ACL is valid
49 * for a particular target.
47 * for a particular target. However, this call is standardized, unlike
48 * the other two forms.
50 */
51int
52acl_valid(acl_t acl)
53{
54 int error;
55
56 acl_sort(acl);
57 error = acl_check(acl);
58 if (error) {
59 errno = error;
60 return (-1);
61 } else {
62 return (0);
63 }
64}
65
66
67int
49 */
50int
51acl_valid(acl_t acl)
52{
53 int error;
54
55 acl_sort(acl);
56 error = acl_check(acl);
57 if (error) {
58 errno = error;
59 return (-1);
60 } else {
61 return (0);
62 }
63}
64
65
66int
68acl_valid_file(const char *pathp, acl_type_t type, acl_t acl)
67acl_valid_file_np(const char *pathp, acl_type_t type, acl_t acl)
69{
70 int error;
71
72 if (acl_posix1e(acl, type)) {
73 error = acl_sort(acl);
74 if (error) {
75 errno = error;
76 return (-1);
77 }
78 }
79
80 return (__acl_aclcheck_file(pathp, type, acl));
81}
82
83
84int
68{
69 int error;
70
71 if (acl_posix1e(acl, type)) {
72 error = acl_sort(acl);
73 if (error) {
74 errno = error;
75 return (-1);
76 }
77 }
78
79 return (__acl_aclcheck_file(pathp, type, acl));
80}
81
82
83int
85acl_valid_fd(int fd, acl_type_t type, acl_t acl)
84acl_valid_fd_np(int fd, acl_type_t type, acl_t acl)
86{
87 int error;
88
89 if (acl_posix1e(acl, type)) {
90 error = acl_sort(acl);
91 if (error) {
92 errno = error;
93 return (-1);
94 }
95 }
96
97 return (__acl_aclcheck_fd(fd, type, acl));
98}
85{
86 int error;
87
88 if (acl_posix1e(acl, type)) {
89 error = acl_sort(acl);
90 if (error) {
91 errno = error;
92 return (-1);
93 }
94 }
95
96 return (__acl_aclcheck_fd(fd, type, acl));
97}