1d97fcfceSRobert Watson.\" Copyright (c) 2001 Networks Associates Technology, Inc. 2d97fcfceSRobert Watson.\" All rights reserved. 3d97fcfceSRobert Watson.\" 4d97fcfceSRobert Watson.\" This software was developed for the FreeBSD Project by Chris 5d97fcfceSRobert Watson.\" Costello at Safeport Network Services and NAI Labs, the Security 6d97fcfceSRobert Watson.\" Research Division of Network Associates, Inc. under DARPA/SPAWAR 7d97fcfceSRobert Watson.\" contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS 8d97fcfceSRobert Watson.\" research program. 9d97fcfceSRobert Watson.\" 10d97fcfceSRobert Watson.\" Redistribution and use in source and binary forms, with or without 11d97fcfceSRobert Watson.\" modification, are permitted provided that the following conditions 12d97fcfceSRobert Watson.\" are met: 13d97fcfceSRobert Watson.\" 1. Redistributions of source code must retain the above copyright 14d97fcfceSRobert Watson.\" notice, this list of conditions and the following disclaimer. 15d97fcfceSRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright 16d97fcfceSRobert Watson.\" notice, this list of conditions and the following disclaimer in the 17d97fcfceSRobert Watson.\" documentation and/or other materials provided with the distribution. 18d97fcfceSRobert Watson.\" 19d97fcfceSRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 20d97fcfceSRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21d97fcfceSRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22d97fcfceSRobert Watson.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 23d97fcfceSRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24d97fcfceSRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25d97fcfceSRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26d97fcfceSRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27d97fcfceSRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28d97fcfceSRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29d97fcfceSRobert Watson.\" SUCH DAMAGE. 30d97fcfceSRobert Watson.\" 31*b653faaaSDag-Erling Smørgrav.Dd September 21, 2023 32d97fcfceSRobert Watson.Dt MAC_TEXT 3 33051bb54bSRuslan Ermilov.Os 34d97fcfceSRobert Watson.Sh NAME 35d97fcfceSRobert Watson.Nm mac_from_text , 36d97fcfceSRobert Watson.Nm mac_to_text 37d97fcfceSRobert Watson.Nd convert MAC label to/from text representation 38d97fcfceSRobert Watson.Sh LIBRARY 39d97fcfceSRobert Watson.Lb libc 40d97fcfceSRobert Watson.Sh SYNOPSIS 41d97fcfceSRobert Watson.In sys/mac.h 42baae0d76SChris Costello.Ft int 43baae0d76SChris Costello.Fn mac_from_text "mac_t *mac" "const char *text" 44baae0d76SChris Costello.Ft int 45baae0d76SChris Costello.Fn mac_to_text "mac_t label" "char **text" 46d97fcfceSRobert Watson.Sh DESCRIPTION 47d97fcfceSRobert WatsonThe 48d97fcfceSRobert Watson.Fn mac_from_text 49d97fcfceSRobert Watsonfunction converts the text representation of a label 50baae0d76SChris Costellointo the internal policy label format 513b296920SRuslan Ermilov.Pq Vt mac_t 52baae0d76SChris Costelloand places it in 53baae0d76SChris Costello.Fa *mac , 54d97fcfceSRobert Watsonwhich must later be freed with 555859b378SRobert Watson.Xr free 3 . 56baae0d76SChris Costello.Pp 57d97fcfceSRobert WatsonThe 58d97fcfceSRobert Watson.Fn mac_to_text 59baae0d76SChris Costellofunction allocates storage for 60baae0d76SChris Costello.Fa *text , 61baae0d76SChris Costellowhich will be set to the text representation of 62baae0d76SChris Costello.Fa label . 63d97fcfceSRobert Watson.Pp 64311e4324SChris CostelloRefer to 65311e4324SChris Costello.Xr maclabel 7 66311e4324SChris Costellofor the MAC label format. 67d97fcfceSRobert Watson.Sh RETURN VALUES 68baae0d76SChris Costello.Rv -std mac_from_text mac_to_text 69d97fcfceSRobert Watson.Sh COMPATIBILITY 70d97fcfceSRobert WatsonPOSIX.1e does not define 712834b91aSChris Costelloa format for text representations 72d97fcfceSRobert Watsonof MAC labels. 735859b378SRobert Watson.Pp 745859b378SRobert WatsonPOSIX.1e requires that text strings allocated using 755859b378SRobert Watson.Fn mac_to_text 765859b378SRobert Watsonbe freed using 775859b378SRobert Watson.Xr mac_free 3 ; 785859b378SRobert Watsonin the 795859b378SRobert Watson.Fx 805859b378SRobert Watsonimplementation, they must be freed using 815859b378SRobert Watson.Xr free 3 , 825859b378SRobert Watsonas 835859b378SRobert Watson.Xr mac_free 3 845859b378SRobert Watsonis used only to free memory used for type 8533992dc0SRuslan Ermilov.Vt mac_t . 86d97fcfceSRobert Watson.Sh ERRORS 87d97fcfceSRobert Watson.Bl -tag -width Er 88d97fcfceSRobert Watson.It Bq Er ENOMEM 89d97fcfceSRobert WatsonInsufficient memory was available 90d97fcfceSRobert Watsonto allocate internal storage. 91d97fcfceSRobert Watson.El 92d97fcfceSRobert Watson.Sh SEE ALSO 935859b378SRobert Watson.Xr free 3 , 94d97fcfceSRobert Watson.Xr mac 3 , 95d97fcfceSRobert Watson.Xr mac_get 3 , 961e5294bcSRobert Watson.Xr mac_is_present 3 , 9776a829fdSChris Costello.Xr mac_prepare 3 , 98311e4324SChris Costello.Xr mac_set 3 , 993a67af38SRobert Watson.Xr posix1e 3 , 100c75fc229SChris Costello.Xr mac 4 , 101311e4324SChris Costello.Xr maclabel 7 102d97fcfceSRobert Watson.Sh STANDARDS 103d97fcfceSRobert WatsonPOSIX.1e is described in IEEE POSIX.1e draft 17. 10409a7f448SRobert Watson.Sh HISTORY 10509a7f448SRobert WatsonSupport for Mandatory Access Control was introduced in 10609a7f448SRobert Watson.Fx 5.0 10709a7f448SRobert Watsonas part of the 10809a7f448SRobert Watson.Tn TrustedBSD 10909a7f448SRobert WatsonProject. 110