xref: /freebsd/lib/libc/posix1e/mac_text.3 (revision 5c8dd342182009cc1c2f55e2551daee99d7d44a8)
1.\" Copyright (c) 2001 Networks Associates Technology, Inc.
2.\" All rights reserved.
3.\"
4.\" This software was developed for the FreeBSD Project by Chris
5.\" Costello at Safeport Network Services and NAI Labs, the Security
6.\" Research Division of Network Associates, Inc. under DARPA/SPAWAR
7.\" contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
8.\" research program.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. The name of the author may not be used to endorse or promote
19.\"    products derived from this software without specific prior written
20.\"    permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\" $FreeBSD$
35.Dd December 21, 2001
36.Dt MAC_TEXT 3
37.Sh NAME
38.Nm mac_from_text ,
39.Nm mac_to_text
40.Nd convert MAC label to/from text representation
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In sys/mac.h
45.Ft mac_t
46.Fn mac_from_text "const char *text_p"
47.Ft "char *"
48.Fn mac_to_text "mac_t label" "size_t *len_p"
49.Sh DESCRIPTION
50The
51.Fn mac_from_text
52function converts the text representation of a label
53into a
54.Vt mac_t ,
55which must later be freed with
56.Xr mac_free .
57The
58.Fn mac_to_text
59function returns
60the text representation of
61.Fa label
62and sets
63.Fa *len_p
64to the length of the returned string.
65.Pp
66Refer to
67.Xr maclabel 7
68for the MAC label format.
69.Sh RETURN VALUES
70The
71.Fn mac_from_text
72function returns a valid
73.Vt mac_t
74equivalent to
75the MAC label described in
76.Fa text_p
77upon success, and
78.Dv NULL
79upon failure, setting
80.Va errno
81to indicate the error.
82.Pp
83The
84.Fn mac_to_text
85function returns a string
86containing the text representation of
87.Fa label
88upon success, and
89.Dv NULL
90upon failure, setting
91.Va errno
92to indicate the error.
93.Sh COMPATIBILITY
94POSIX.1e does not define
95a text format for text representations
96of MAC labels.
97.Sh ERRORS
98.Bl -tag -width Er
99.It Bq Er EINVAL
100An invalid policy or qualifier
101was specified in
102.Fa text_p ,
103or an invalid MAC label
104was specified in
105.Fa label .
106.It Bq Er ENOMEM
107Insufficient memory was available
108to allocate internal storage.
109.El
110.Sh SEE ALSO
111.Xr mac 3 ,
112.Xr mac_free 3 ,
113.Xr mac_get 3 ,
114.Xr mac_set 3 ,
115.Xr maclabel 7
116.Sh STANDARDS
117POSIX.1e is described in IEEE POSIX.1e draft 17.
118Discussion of the draft
119continues on the cross-platform POSIX.1e implementation mailing list.
120To join this list, see the
121.Fx
122POSIX.1e implementation page
123for more information.
124