xref: /netbsd-src/lib/libc/posix1e/acl_valid.3 (revision 1b3734281f17fd86d3db0e29f84ea9985be6fe06)
1.\" $NetBSD: acl_valid.3,v 1.2 2020/06/18 19:46:34 wiz Exp $
2.\"-
3.\" Copyright (c) 2000, 2002 Robert N. M. Watson
4.\" All rights reserved.
5.\"
6.\" This software was developed by Robert Watson for the TrustedBSD Project.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\" $FreeBSD: head/lib/libc/posix1e/acl_valid.3 140288 2005-01-15 12:21:03Z ru $
30.\"
31.Dd December 29, 2002
32.Dt ACL_VALID 3
33.Os
34.Sh NAME
35.Nm acl_valid ,
36.Nm acl_valid_fd_np ,
37.Nm acl_valid_file_np ,
38.Nm acl_valid_link_np
39.Nd validate an ACL
40.Sh LIBRARY
41.Lb libc
42.Sh SYNOPSIS
43.In sys/types.h
44.In sys/acl.h
45.Ft int
46.Fn acl_valid "acl_t acl"
47.Ft int
48.Fn acl_valid_fd_np "int fd" "acl_type_t type" "acl_t acl"
49.Ft int
50.Fn acl_valid_file_np "const char *path_p" "acl_type_t type" "acl_t acl"
51.Ft int
52.Fn acl_valid_link_np "const char *path_p" "acl_type_t type" "acl_t acl"
53.Sh DESCRIPTION
54These functions check that the ACL referred to by the argument
55.Va acl
56is valid.
57The POSIX.1e routine,
58.Fn acl_valid ,
59checks this validity only with POSIX.1e ACL semantics, and irrespective
60of the context in which the ACL is to be used.
61The non-portable forms,
62.Fn acl_valid_fd_np ,
63.Fn acl_valid_file_np ,
64and
65.Fn acl_valid_link_np
66allow an ACL to be checked in the context of a specific acl type,
67.Va type ,
68and file system object.
69In environments where additional ACL types are
70supported than just POSIX.1e, this makes more sense.
71Whereas
72.Fn acl_valid_file_np
73will follow the symlink if the specified path is to a symlink,
74.Fn acl_valid_link_np
75will not.
76.Pp
77For POSIX.1e semantics, the checks include:
78.Bl -bullet
79.It
80The three required entries
81.Dv ( ACL_USER_OBJ , ACL_GROUP_OBJ ,
82and
83.Dv ACL_OTHER )
84shall exist exactly once in the ACL.
85If the ACL contains any
86.Dv ACL_USER , ACL_GROUP ,
87or any other
88implementation-defined entries in the file group class
89then one
90.Dv ACL_MASK
91entry shall also be required.
92The ACL shall contain at most one
93.Dv ACL_MASK
94entry.
95.It
96The qualifier field shall be unique among all entries of
97the same POSIX.1e ACL facility defined tag type.
98The
99tag type field shall contain valid values including any
100implementation-defined values.
101Validation of the values
102of the qualifier field is implementation-defined.
103.El
104.Pp
105The POSIX.1e
106.Fn acl_valid
107function may reorder the ACL for the purposes of verification; the
108non-portable validation functions will not.
109.Sh IMPLEMENTATION NOTES
110.Fx Ns 's
111support for POSIX.1e interfaces and features is still under
112development at this time.
113.Sh RETURN VALUES
114.Rv -std
115.Sh ERRORS
116If any of the following conditions occur, these functions shall return
117-1 and set
118.Va errno
119to the corresponding value:
120.Bl -tag -width Er
121.It Bq Er EACCES
122Search permission is denied for a component of the path prefix, or the
123object exists and the process does not have appropriate access rights.
124.It Bq Er EBADF
125The
126.Va fd
127argument is not a valid file descriptor.
128.It Bq Er EINVAL
129Argument
130.Va acl
131does not point to a valid ACL.
132.Pp
133One or more of the required ACL entries is not present in
134.Va acl .
135.Pp
136The ACL contains entries that are not unique.
137.Pp
138The file system rejects the ACL based on fs-specific semantics issues.
139.It Bq Er ENAMETOOLONG
140A component of a pathname exceeded 255 characters, or an
141entire path name exceeded 1023 characters.
142.It Bq Er ENOENT
143The named object does not exist, or the
144.Va path_p
145argument points to an empty string.
146.It Bq Er ENOMEM
147Insufficient memory available to fulfill request.
148.It Bq Er EOPNOTSUPP
149The file system does not support ACL retrieval.
150.El
151.Sh SEE ALSO
152.Xr acl 3 ,
153.Xr acl_get 3 ,
154.Xr acl_init 3 ,
155.Xr acl_set 3 ,
156.Xr posix1e 3
157.Sh STANDARDS
158POSIX.1e is described in IEEE POSIX.1e draft 17.
159Discussion
160of the draft continues on the cross-platform POSIX.1e implementation
161mailing list.
162To join this list, see the
163.Fx
164POSIX.1e implementation
165page for more information.
166.Sh HISTORY
167POSIX.1e support was introduced in
168.Fx 4.0 ,
169and development continues.
170.Sh AUTHORS
171.An Robert N M Watson
172