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.\" 31d97fcfceSRobert Watson.\" $FreeBSD$ 323b296920SRuslan Ermilov.\" 33d97fcfceSRobert Watson.Dd December 21, 2001 34d97fcfceSRobert Watson.Dt MAC_GET 3 35051bb54bSRuslan Ermilov.Os 36d97fcfceSRobert Watson.Sh NAME 37d97fcfceSRobert Watson.Nm mac_get_file , 38d97fcfceSRobert Watson.Nm mac_get_fd , 39d97fcfceSRobert Watson.Nm mac_get_proc 40d97fcfceSRobert Watson.Nd get the label of a file, socket, socket peer or process 413b296920SRuslan Ermilov.Sh LIBRARY 423b296920SRuslan Ermilov.Lb libc 43d97fcfceSRobert Watson.Sh SYNOPSIS 44d97fcfceSRobert Watson.In sys/mac.h 4576a829fdSChris Costello.Ft int 4676a829fdSChris Costello.Fn mac_get_file "const char *path" "mac_t label" 4776a829fdSChris Costello.Ft int 4876a829fdSChris Costello.Fn mac_get_fd "int fd" "mac_t label" 4976a829fdSChris Costello.Ft int 5076a829fdSChris Costello.Fn mac_get_pid "pid_t pid" "mac_t label" 5176a829fdSChris Costello.Ft int 5276a829fdSChris Costello.Fn mac_get_proc "mac_t label" 53d97fcfceSRobert Watson.Sh DESCRIPTION 54d97fcfceSRobert WatsonThe 55d97fcfceSRobert Watson.Fn mac_get_file 56d97fcfceSRobert Watsonand 57d97fcfceSRobert Watson.Fn mac_get_fd 5876a829fdSChris Costellofunctions fill in 5976a829fdSChris Costello.Fa label 6076a829fdSChris Costello(which must first be allocated by 6176a829fdSChris Costello.Xr mac_prepare 3 ) 6276a829fdSChris Costellowith the MAC label associated with the file referenced by 6376a829fdSChris Costello.Fa path 64d97fcfceSRobert Watsonor the file descriptor specified by 65d97fcfceSRobert Watson.Fa fd , 663b296920SRuslan Ermilovrespectively. 673b296920SRuslan ErmilovNote that this function will fail on socket descriptors. 683b296920SRuslan ErmilovFor information on 69d97fcfceSRobert Watsongetting MAC labels on socket descriptors see 70d97fcfceSRobert Watson.Xr getsockopt 2 . 7176a829fdSChris Costello.Pp 72d97fcfceSRobert WatsonThe 73d97fcfceSRobert Watson.Fn mac_get_proc 7476a829fdSChris Costelloand 7576a829fdSChris Costello.Fn mac_get_pid 7676a829fdSChris Costellofunctions fill in 7776a829fdSChris Costello.Fa label 7876a829fdSChris Costello(which must first be allocated by 7976a829fdSChris Costello.Xr mac_prepare 3 ) 8076a829fdSChris Costellowith the MAC label associated 8176a829fdSChris Costellowith the requesting process 8276a829fdSChris Costelloor the specified process, respectively. 83d97fcfceSRobert Watson.Sh ERRORS 84d97fcfceSRobert Watson.Bl -tag -width Er 85d97fcfceSRobert Watson.It Bq Er EACCES 86d97fcfceSRobert WatsonA component of 8776a829fdSChris Costello.Fa path 88d97fcfceSRobert Watsonis not searchable, 89d97fcfceSRobert Watsonor MAC read access to the file 90d97fcfceSRobert Watsonis denied. 91d97fcfceSRobert Watson.It Bq Er ENAMETOOLONG 92d97fcfceSRobert WatsonThe pathname pointed to by 9376a829fdSChris Costello.Fa path 94d97fcfceSRobert Watsonexceeds 95d97fcfceSRobert Watson.Dv PATH_MAX , 96d97fcfceSRobert Watsonor a component of the pathname exceeds 97d97fcfceSRobert Watson.Dv NAME_MAX . 98d97fcfceSRobert Watson.It Bq Er ENOENT 99d97fcfceSRobert WatsonA component of 10076a829fdSChris Costello.Fa path 101d97fcfceSRobert Watsondoes not exist. 102d97fcfceSRobert Watson.It Bq Er ENOMEM 103d97fcfceSRobert WatsonInsufficient memory is available 104d97fcfceSRobert Watsonto allocate a new MAC label structure. 105d97fcfceSRobert Watson.It Bq Er ENOTDIR 106d97fcfceSRobert WatsonA component of 10776a829fdSChris Costello.Fa path 108d97fcfceSRobert Watsonis not a directory. 109d97fcfceSRobert Watson.El 110d97fcfceSRobert Watson.Sh SEE ALSO 111d97fcfceSRobert Watson.Xr mac 3 , 112d97fcfceSRobert Watson.Xr mac_free 3 , 11376a829fdSChris Costello.Xr mac_text 3 , 11476a829fdSChris Costello.Xr mac_prepare 3 , 1153b296920SRuslan Ermilov.Xr mac_set 3 , 1168f8690e7SChris Costello.Xr mac 4 , 11776a829fdSChris Costello.Xr mac 9 118d97fcfceSRobert Watson.Sh STANDARDS 119d97fcfceSRobert WatsonPOSIX.1e is described in IEEE POSIX.1e draft 17. 120d97fcfceSRobert WatsonDiscussion of the draft 121d97fcfceSRobert Watsoncontinues on the cross-platform POSIX.1e implementation mailing list. 122d97fcfceSRobert WatsonTo join this list, see the 123d97fcfceSRobert Watson.Fx 124d97fcfceSRobert WatsonPOSIX.1e implementation page 125d97fcfceSRobert Watsonfor more information. 126