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.\" 3. The name of the author may not be used to endorse or promote 19d97fcfceSRobert Watson.\" products derived from this software without specific prior written 20d97fcfceSRobert Watson.\" permission. 21d97fcfceSRobert Watson.\" 22d97fcfceSRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 23d97fcfceSRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24d97fcfceSRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25d97fcfceSRobert Watson.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 26d97fcfceSRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27d97fcfceSRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28d97fcfceSRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29d97fcfceSRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30d97fcfceSRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31d97fcfceSRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32d97fcfceSRobert Watson.\" SUCH DAMAGE. 33d97fcfceSRobert Watson.\" 34d97fcfceSRobert Watson.\" $FreeBSD$ 35d97fcfceSRobert Watson.Dd December 21, 2001 36d97fcfceSRobert Watson.Dt MAC_TEXT 3 37d97fcfceSRobert Watson.Sh NAME 38d97fcfceSRobert Watson.Nm mac_from_text , 39d97fcfceSRobert Watson.Nm mac_to_text 40d97fcfceSRobert Watson.Nd convert MAC label to/from text representation 41d97fcfceSRobert Watson.Sh LIBRARY 42d97fcfceSRobert Watson.Lb libc 43d97fcfceSRobert Watson.Sh SYNOPSIS 44d97fcfceSRobert Watson.In sys/mac.h 45d97fcfceSRobert Watson.Ft mac_t 46d97fcfceSRobert Watson.Fn mac_from_text "const char *text_p" 47d97fcfceSRobert Watson.Ft "char *" 48d97fcfceSRobert Watson.Fn mac_to_text "mac_t label" "size_t *len_p" 49d97fcfceSRobert Watson.Sh DESCRIPTION 50d97fcfceSRobert WatsonThe 51d97fcfceSRobert Watson.Fn mac_from_text 52d97fcfceSRobert Watsonfunction converts the text representation of a label 53d97fcfceSRobert Watsoninto a 54d97fcfceSRobert Watson.Vt mac_t , 55d97fcfceSRobert Watsonwhich must later be freed with 56d97fcfceSRobert Watson.Xr mac_free . 57d97fcfceSRobert WatsonThe 58d97fcfceSRobert Watson.Fn mac_to_text 59d97fcfceSRobert Watsonfunction returns 60d97fcfceSRobert Watsonthe text representation of 61d97fcfceSRobert Watson.Fa label 62d97fcfceSRobert Watsonand sets 63d97fcfceSRobert Watson.Fa *len_p 64d97fcfceSRobert Watsonto the length of the returned string. 65d97fcfceSRobert Watson.Pp 66d97fcfceSRobert Watson.Fx 67d97fcfceSRobert Watsonuses the following format 68d97fcfceSRobert Watsonfor MAC policy text representations: 69d97fcfceSRobert Watson.Pp 70d97fcfceSRobert Watson.Dl Sy policy Ns No / Ns Sy qualifier 71d97fcfceSRobert Watson.Pp 72d97fcfceSRobert WatsonWhere 73d97fcfceSRobert Watson.Sy policy 74d97fcfceSRobert Watsoncan be one of 75d97fcfceSRobert Watson.Dq biba , 76d97fcfceSRobert Watson.Dq mls , 77d97fcfceSRobert Watsonor 78d97fcfceSRobert Watson.Dq te . 79d97fcfceSRobert Watson.Pp 80d97fcfceSRobert WatsonValid labels can have the following arguments for 81d97fcfceSRobert Watson.Sy qualifier , 82d97fcfceSRobert Watsondepending on the value of 83d97fcfceSRobert Watson.Sy policy . 84d97fcfceSRobert Watson.Bl -tag -width "Policy" -offset indent 85d97fcfceSRobert Watson.It Em Policy 86d97fcfceSRobert Watson.Em Qualifier 87d97fcfceSRobert Watson.It biba 88d97fcfceSRobert Watson.Dq high , 89d97fcfceSRobert Watson.Dq low , 90d97fcfceSRobert Watson.Dq equal , 91d97fcfceSRobert Watsonor a numeric grade. 92d97fcfceSRobert Watson.It mls 93d97fcfceSRobert Watson.Dq high , 94d97fcfceSRobert Watson.Dq low , 95d97fcfceSRobert Watson.Dq equal , 96d97fcfceSRobert Watsonor a numeric level. 97d97fcfceSRobert Watson.It te 98d97fcfceSRobert WatsonTypes for 99d97fcfceSRobert Watson.Dq te 100d97fcfceSRobert Watsonconsist of a type name which must 101d97fcfceSRobert Watsonneither be empty nor exceed the length limit for the label. 102d97fcfceSRobert Watson.El 103d97fcfceSRobert Watson.Pp 104d97fcfceSRobert WatsonAll policies must be present 105d97fcfceSRobert Watsonin a comma-separated list, 106d97fcfceSRobert Watsonbut may be in any order 107d97fcfceSRobert Watson(see 108d97fcfceSRobert Watson.Sx EXAMPLES ) . 109d97fcfceSRobert Watson.Sh RETURN VALUES 110d97fcfceSRobert WatsonThe 111d97fcfceSRobert Watson.Fn mac_from_text 112d97fcfceSRobert Watsonfunction returns a valid 113d97fcfceSRobert Watson.Vt mac_t 114d97fcfceSRobert Watsonequivalent to 115d97fcfceSRobert Watsonthe MAC label described in 116d97fcfceSRobert Watson.Fa text_p 117d97fcfceSRobert Watsonupon success, and 118d97fcfceSRobert Watson.Dv NULL 119d97fcfceSRobert Watsonupon failure, setting 120d97fcfceSRobert Watson.Va errno 121d97fcfceSRobert Watsonto indicate the error. 122d97fcfceSRobert Watson.Pp 123d97fcfceSRobert WatsonThe 124d97fcfceSRobert Watson.Fn mac_to_text 125d97fcfceSRobert Watsonfunction returns a string 126d97fcfceSRobert Watsoncontaining the text representation of 127d97fcfceSRobert Watson.Fa label 128d97fcfceSRobert Watsonupon success, and 129d97fcfceSRobert Watson.Dv NULL 130d97fcfceSRobert Watsonupon failure, setting 131d97fcfceSRobert Watson.Va errno 132d97fcfceSRobert Watsonto indicate the error. 133d97fcfceSRobert Watson.Sh EXAMPLES 134d97fcfceSRobert WatsonThe following are valid MAC labels: 135d97fcfceSRobert Watson.Bd -literal -offset indent 136d97fcfceSRobert Watsonbiba/high,mls/low,te/none 137d97fcfceSRobert Watsonbiba/low,mls/low,te/none 138d97fcfceSRobert Watsonbiba/low,mls/3,te/none 139d97fcfceSRobert Watson.Ed 140d97fcfceSRobert Watson.Sh COMPATIBILITY 141d97fcfceSRobert WatsonPOSIX.1e does not define 142d97fcfceSRobert Watsona text format for text representations 143d97fcfceSRobert Watsonof MAC labels. 144d97fcfceSRobert Watson.Sh ERRORS 145d97fcfceSRobert Watson.Bl -tag -width Er 146d97fcfceSRobert Watson.It Bq Er EINVAL 147d97fcfceSRobert WatsonAn invalid policy or qualifier 148d97fcfceSRobert Watsonwas specified in 149d97fcfceSRobert Watson.Fa text_p , 150d97fcfceSRobert Watsonor an invalid MAC label 151d97fcfceSRobert Watsonwas specified in 152d97fcfceSRobert Watson.Fa label . 153d97fcfceSRobert Watson.It Bq Er ENOMEM 154d97fcfceSRobert WatsonInsufficient memory was available 155d97fcfceSRobert Watsonto allocate internal storage. 156d97fcfceSRobert Watson.El 157d97fcfceSRobert Watson.Sh SEE ALSO 158d97fcfceSRobert Watson.Xr mac 3 , 159d97fcfceSRobert Watson.Xr mac_free 3 , 160d97fcfceSRobert Watson.Xr mac_get 3 , 161d97fcfceSRobert Watson.Xr mac_set 3 162d97fcfceSRobert Watson.Sh STANDARDS 163d97fcfceSRobert WatsonPOSIX.1e is described in IEEE POSIX.1e draft 17. 164d97fcfceSRobert WatsonDiscussion of the draft 165d97fcfceSRobert Watsoncontinues on the cross-platform POSIX.1e implementation mailing list. 166d97fcfceSRobert WatsonTo join this list, see the 167d97fcfceSRobert Watson.Fx 168d97fcfceSRobert WatsonPOSIX.1e implementation page 169d97fcfceSRobert Watsonfor more information. 170