xref: /freebsd/lib/libc/posix1e/mac_text.3 (revision b00ab754)
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.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\" $FreeBSD$
32.\"
33.Dd December 21, 2001
34.Dt MAC_TEXT 3
35.Os
36.Sh NAME
37.Nm mac_from_text ,
38.Nm mac_to_text
39.Nd convert MAC label to/from text representation
40.Sh LIBRARY
41.Lb libc
42.Sh SYNOPSIS
43.In sys/mac.h
44.Ft int
45.Fn mac_from_text "mac_t *mac" "const char *text"
46.Ft int
47.Fn mac_to_text "mac_t label" "char **text"
48.Sh DESCRIPTION
49The
50.Fn mac_from_text
51function converts the text representation of a label
52into the internal policy label format
53.Pq Vt mac_t
54and places it in
55.Fa *mac ,
56which must later be freed with
57.Xr free 3 .
58.Pp
59The
60.Fn mac_to_text
61function allocates storage for
62.Fa *text ,
63which will be set to the text representation of
64.Fa label .
65.Pp
66Refer to
67.Xr maclabel 7
68for the MAC label format.
69.Sh RETURN VALUES
70.Rv -std mac_from_text mac_to_text
71.Sh COMPATIBILITY
72POSIX.1e does not define
73a format for text representations
74of MAC labels.
75.Pp
76POSIX.1e requires that text strings allocated using
77.Fn mac_to_text
78be freed using
79.Xr mac_free 3 ;
80in the
81.Fx
82implementation, they must be freed using
83.Xr free 3 ,
84as
85.Xr mac_free 3
86is used only to free memory used for type
87.Vt mac_t .
88.Sh ERRORS
89.Bl -tag -width Er
90.It Bq Er ENOMEM
91Insufficient memory was available
92to allocate internal storage.
93.El
94.Sh SEE ALSO
95.Xr free 3 ,
96.Xr mac 3 ,
97.Xr mac_get 3 ,
98.Xr mac_is_present 3 ,
99.Xr mac_prepare 3 ,
100.Xr mac_set 3 ,
101.Xr posix1e 3 ,
102.Xr mac 4 ,
103.Xr maclabel 7
104.Sh STANDARDS
105POSIX.1e is described in IEEE POSIX.1e draft 17.
106Discussion of the draft
107continues on the cross-platform POSIX.1e implementation mailing list.
108To join this list, see the
109.Fx
110POSIX.1e implementation page
111for more information.
112.Sh HISTORY
113Support for Mandatory Access Control was introduced in
114.Fx 5.0
115as part of the
116.Tn TrustedBSD
117Project.
118