xref: /netbsd-src/lib/libc/posix1e/acl_to_text.3 (revision 1b3734281f17fd86d3db0e29f84ea9985be6fe06)
1.\" $NetBSD: acl_to_text.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_to_text.3 318709 2017-05-23 07:12:31Z ngie $
30.\"
31.Dd June 25, 2009
32.Dt ACL_TO_TEXT 3
33.Os
34.Sh NAME
35.Nm acl_to_text ,
36.Nm acl_to_text_np
37.Nd convert an ACL to text
38.Sh LIBRARY
39.Lb libc
40.Sh SYNOPSIS
41.In sys/types.h
42.In sys/acl.h
43.Ft char *
44.Fn acl_to_text "acl_t acl" "ssize_t *len_p"
45.Ft char *
46.Fn acl_to_text_np "acl_t acl" "ssize_t *len_p" "int flags"
47.Sh DESCRIPTION
48The
49.Fn acl_to_text
50and
51.Fn acl_to_text_np
52functions translate the ACL pointed to by argument
53.Va acl
54into a NULL terminated character string.
55If the pointer
56.Va len_p
57is not NULL, then the function shall return the length of the string (not
58including the NULL terminator) in the location pointed to by
59.Va len_p .
60If the ACL is POSIX.1e, the format of the text string returned by
61.Fn acl_to_text
62shall be the POSIX.1e long ACL form.
63If the ACL is NFSv4, the format of the text string shall be the compact form, unless
64the
65.Va ACL_TEXT_VERBOSE
66flag is given.
67.Pp
68The flags specified are formed by
69.Em or Ns 'ing
70the following values
71.Bl -column -offset 3n "ACL_TEXT_NUMERIC_IDS"
72.It ACL_TEXT_VERBOSE Ta "Format ACL using verbose form"
73.It ACL_TEXT_NUMERIC_IDS Ta "Do not resolve IDs into user or group names"
74.It ACL_TEXT_APPEND_ID Ta "In addition to user and group names, append numeric IDs"
75.El
76.Pp
77This function allocates any memory necessary to contain the string and
78returns a pointer to the string.
79The caller should free any releasable
80memory, when the new string is no longer required, by calling
81.Xr acl_free 3
82with the
83.Va (void*)char
84as an argument.
85.Sh IMPLEMENTATION NOTES
86.Fx Ns 's
87support for POSIX.1e interfaces and features is still under
88development at this time.
89.Sh RETURN VALUES
90Upon successful completion, the function shall return a pointer to the
91long text form of an ACL.
92Otherwise, a value of
93.Va (char*)NULL
94shall be returned and
95.Va errno
96shall be set to indicate the error.
97.Sh ERRORS
98If any of the following conditions occur, the
99.Fn acl_to_text
100function shall return a value of
101.Va (acl_t)NULL
102and set
103.Va errno
104to the corresponding value:
105.Bl -tag -width Er
106.It Bq Er EINVAL
107Argument
108.Va acl
109does not point to a valid ACL.
110.Pp
111The ACL denoted by
112.Va acl
113contains one or more improperly formed ACL entries, or for some other
114reason cannot be translated into a text form of an ACL.
115.It Bq Er ENOMEM
116The character string to be returned requires more memory than is allowed
117by the hardware or software-imposed memory management constraints.
118.El
119.Sh SEE ALSO
120.Xr acl 3 ,
121.Xr acl_free 3 ,
122.Xr acl_from_text 3 ,
123.Xr posix1e 3
124.Sh STANDARDS
125POSIX.1e is described in IEEE POSIX.1e draft 17.
126Discussion
127of the draft continues on the cross-platform POSIX.1e implementation
128mailing list.
129To join this list, see the
130.Fx
131POSIX.1e implementation
132page for more information.
133.Sh HISTORY
134POSIX.1e support was introduced in
135.Fx 4.0 ,
136and development continues.
137.Sh AUTHORS
138.An Robert N M Watson
139.Sh BUGS
140The
141.Fn acl_from_text
142and
143.Fn acl_to_text
144functions
145rely on the
146.Xr getpwent 3
147library calls to manage username and uid mapping, as well as the
148.Xr getgrent 3
149library calls to manage groupname and gid mapping.
150These calls are not
151thread safe, and so transitively, neither are
152.Fn acl_from_text
153and
154.Fn acl_to_text .
155These functions may also interfere with stateful
156calls associated with the
157.Fn getpwent
158and
159.Fn getgrent
160calls.
161