xref: /netbsd-src/lib/libc/posix1e/acl_add_perm.3 (revision 1b3734281f17fd86d3db0e29f84ea9985be6fe06)
1.\" $NetBSD: acl_add_perm.3,v 1.2 2020/06/18 19:46:34 wiz Exp $
2.\"-
3.\" Copyright (c) 2001 Chris D. Faulhaber
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" $FreeBSD: head/lib/libc/posix1e/acl_add_perm.3 267774 2014-06-23 08:25:03Z bapt $
28.\"
29.Dd June 25, 2009
30.Dt ACL_ADD_PERM 3
31.Os
32.Sh NAME
33.Nm acl_add_perm
34.Nd add permissions to a permission set
35.Sh LIBRARY
36.Lb libc
37.Sh SYNOPSIS
38.In sys/types.h
39.In sys/acl.h
40.Ft int
41.Fn acl_add_perm "acl_permset_t permset_d" "acl_perm_t perm"
42.Sh DESCRIPTION
43The
44.Fn acl_add_perm
45function
46is a POSIX.1e call that adds the permission contained in
47.Fa perm
48to the permission set
49.Fa permset_d .
50.Pp
51Note: it is not considered an error to attempt to add permissions
52that already exist in the permission set.
53.Pp
54For POSIX.1e ACLs, valid values are:
55.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
56.It ACL_EXECUTE	Execute permission
57.It ACL_WRITE	Write permission
58.It ACL_READ	Read permission
59.El
60.Pp
61For NFSv4 ACLs, valid values are:
62.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS"
63.It ACL_READ_DATA Ta "Read permission"
64.It ACL_LIST_DIRECTORY Ta "Same as ACL_READ_DATA"
65.It ACL_WRITE_DATA Ta "Write permission, or permission to create files"
66.It ACL_ADD_FILE Ta "Same as ACL_READ_DATA"
67.It ACL_APPEND_DATA Ta "Permission to create directories.  Ignored for files"
68.It ACL_ADD_SUBDIRECTORY Ta "Same as ACL_APPEND_DATA"
69.It ACL_READ_NAMED_ATTRS Ta "Ignored"
70.It ACL_WRITE_NAMED_ATTRS Ta "Ignored"
71.It ACL_EXECUTE Ta "Execute permission"
72.It ACL_DELETE_CHILD Ta "Permission to delete files and subdirectories"
73.It ACL_READ_ATTRIBUTES Ta "Permission to read basic attributes"
74.It ACL_WRITE_ATTRIBUTES Ta "Permission to change basic attributes"
75.It ACL_DELETE Ta "Permission to delete the object this ACL is placed on"
76.It ACL_READ_ACL Ta "Permission to read ACL"
77.It ACL_WRITE_ACL Ta "Permission to change the ACL and file mode"
78.It ACL_SYNCHRONIZE Ta "Ignored"
79.El
80.Pp
81Calling
82.Fn acl_add_perm
83with
84.Fa perm
85equal to ACL_WRITE or ACL_READ brands the ACL as POSIX.
86Calling it with ACL_READ_DATA, ACL_LIST_DIRECTORY, ACL_WRITE_DATA,
87ACL_ADD_FILE, ACL_APPEND_DATA, ACL_ADD_SUBDIRECTORY, ACL_READ_NAMED_ATTRS,
88ACL_WRITE_NAMED_ATTRS, ACL_DELETE_CHILD, ACL_READ_ATTRIBUTES,
89ACL_WRITE_ATTRIBUTES, ACL_DELETE, ACL_READ_ACL, ACL_WRITE_ACL
90or ACL_SYNCHRONIZE brands the ACL as NFSv4.
91.Sh RETURN VALUES
92.Rv -std acl_add_perm
93.Sh ERRORS
94The
95.Fn acl_add_perm
96function fails if:
97.Bl -tag -width Er
98.It Bq Er EINVAL
99Argument
100.Fa permset_d
101is not a valid descriptor for a permission set within an ACL entry.
102Argument
103.Fa perm
104does not contain a valid
105.Vt acl_perm_t
106value.
107ACL is already branded differently.
108.El
109.Sh SEE ALSO
110.Xr acl 3 ,
111.Xr acl_clear_perms 3 ,
112.Xr acl_delete_perm 3 ,
113.Xr acl_get_brand_np 3 ,
114.Xr acl_get_permset 3 ,
115.Xr acl_set_permset 3 ,
116.Xr posix1e 3
117.Sh STANDARDS
118POSIX.1e is described in IEEE POSIX.1e draft 17.
119.Sh HISTORY
120POSIX.1e support was introduced in
121.Fx 4.0 .
122The
123.Fn acl_add_perm
124function was added in
125.Fx 5.0 .
126.Sh AUTHORS
127The
128.Fn acl_add_perm
129function was written by
130.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
131