xref: /freebsd/lib/libc/posix1e/acl_add_perm.3 (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1.\"-
2.\" Copyright (c) 2001 Chris D. Faulhaber
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.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
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.Dd June 25, 2009
27.Dt ACL_ADD_PERM 3
28.Os
29.Sh NAME
30.Nm acl_add_perm
31.Nd add permissions to a permission set
32.Sh LIBRARY
33.Lb libc
34.Sh SYNOPSIS
35.In sys/types.h
36.In sys/acl.h
37.Ft int
38.Fn acl_add_perm "acl_permset_t permset_d" "acl_perm_t perm"
39.Sh DESCRIPTION
40The
41.Fn acl_add_perm
42function
43is a POSIX.1e call that adds the permission contained in
44.Fa perm
45to the permission set
46.Fa permset_d .
47.Pp
48Note: it is not considered an error to attempt to add permissions
49that already exist in the permission set.
50.Pp
51For POSIX.1e ACLs, valid values are:
52.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
53.It ACL_EXECUTE	Execute permission
54.It ACL_WRITE	Write permission
55.It ACL_READ	Read permission
56.El
57.Pp
58For NFSv4 ACLs, valid values are:
59.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
60.It ACL_READ_DATA Ta "Read permission"
61.It ACL_LIST_DIRECTORY Ta "Same as ACL_READ_DATA"
62.It ACL_WRITE_DATA Ta "Write permission, or permission to create files"
63.It ACL_ADD_FILE Ta "Same as ACL_READ_DATA"
64.It ACL_APPEND_DATA Ta "Permission to create directories.  Ignored for files"
65.It ACL_ADD_SUBDIRECTORY Ta "Same as ACL_APPEND_DATA"
66.It ACL_READ_NAMED_ATTRS Ta "Ignored"
67.It ACL_WRITE_NAMED_ATTRS Ta "Ignored"
68.It ACL_EXECUTE Ta "Execute permission"
69.It ACL_DELETE_CHILD Ta "Permission to delete files and subdirectories"
70.It ACL_READ_ATTRIBUTES Ta "Permission to read basic attributes"
71.It ACL_WRITE_ATTRIBUTES Ta "Permission to change basic attributes"
72.It ACL_DELETE Ta "Permission to delete the object this ACL is placed on"
73.It ACL_READ_ACL Ta "Permission to read ACL"
74.It ACL_WRITE_ACL Ta "Permission to change the ACL and file mode"
75.It ACL_SYNCHRONIZE Ta "Ignored"
76.El
77.Pp
78Calling
79.Fn acl_add_perm
80with
81.Fa perm
82equal to ACL_WRITE or ACL_READ brands the ACL as POSIX.
83Calling it with ACL_READ_DATA, ACL_LIST_DIRECTORY, ACL_WRITE_DATA,
84ACL_ADD_FILE, ACL_APPEND_DATA, ACL_ADD_SUBDIRECTORY, ACL_READ_NAMED_ATTRS,
85ACL_WRITE_NAMED_ATTRS, ACL_DELETE_CHILD, ACL_READ_ATTRIBUTES,
86ACL_WRITE_ATTRIBUTES, ACL_DELETE, ACL_READ_ACL, ACL_WRITE_ACL
87or ACL_SYNCHRONIZE brands the ACL as NFSv4.
88.Sh RETURN VALUES
89.Rv -std acl_add_perm
90.Sh ERRORS
91The
92.Fn acl_add_perm
93function fails if:
94.Bl -tag -width Er
95.It Bq Er EINVAL
96Argument
97.Fa permset_d
98is not a valid descriptor for a permission set within an ACL entry.
99Argument
100.Fa perm
101does not contain a valid
102.Vt acl_perm_t
103value.
104ACL is already branded differently.
105.El
106.Sh SEE ALSO
107.Xr acl 3 ,
108.Xr acl_clear_perms 3 ,
109.Xr acl_delete_perm 3 ,
110.Xr acl_get_brand_np 3 ,
111.Xr acl_get_permset 3 ,
112.Xr acl_set_permset 3 ,
113.Xr posix1e 3
114.Sh STANDARDS
115POSIX.1e is described in IEEE POSIX.1e draft 17.
116.Sh HISTORY
117POSIX.1e support was introduced in
118.Fx 4.0 .
119The
120.Fn acl_add_perm
121function was added in
122.Fx 5.0 .
123.Sh AUTHORS
124The
125.Fn acl_add_perm
126function was written by
127.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
128