From 200d3a3d43a363fd0938b638a20c45aedbaaa282 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 15 Jan 2003 00:45:31 +0000 Subject: o Document mac_prepare() and associated functions o Link mac_get_pid.3 to mac_get.3 o Update SEE ALSO to refer to mac_prepare, and added missing references o Remove clause #3 on my work o Update mac_get.3 for the updated MAC API Sponsored by: DARPA, Network Associates Laboratories Obtained from: TrustedBSD Project --- lib/libc/posix1e/Makefile.inc | 6 +++++ lib/libc/posix1e/mac.3 | 2 ++ lib/libc/posix1e/mac_free.3 | 4 ++- lib/libc/posix1e/mac_get.3 | 51 ++++++++++++++++++++++-------------- lib/libc/posix1e/mac_is_present.3 | 11 +++++--- lib/libc/posix1e/mac_is_present_np.3 | 11 +++++--- lib/libc/posix1e/mac_set.3 | 4 ++- lib/libc/posix1e/mac_text.3 | 5 ++-- 8 files changed, 61 insertions(+), 33 deletions(-) (limited to 'lib/libc/posix1e') diff --git a/lib/libc/posix1e/Makefile.inc b/lib/libc/posix1e/Makefile.inc index 4e6f98a..1aba030 100644 --- a/lib/libc/posix1e/Makefile.inc +++ b/lib/libc/posix1e/Makefile.inc @@ -54,6 +54,7 @@ MAN+= acl.3 \ mac_free.3 \ mac_is_present_np.3 \ mac_get.3 \ + mac_prepare.3 \ mac_set.3 \ mac_text.3 \ posix1e.3 @@ -73,7 +74,12 @@ MLINKS+=acl_delete.3 acl_delete_def_file.3 \ extattr.3 extattr_string_to_namespace.3 \ mac_get.3 mac_get_fd.3 \ mac_get.3 mac_get_file.3 \ + mac_get.3 mac_get_pid.3 \ mac_get.3 mac_get_proc.3 \ + mac_prepare.3 mac_prepare_file_label.3 \ + mac_prepare.3 mac_prepare_ifnet_label.3 \ + mac_prepare.3 mac_prepare_process_label.3 \ + mac_set.3 mac_set_link.3 \ mac_set.3 mac_set_fd.3 \ mac_set.3 mac_set_file.3 \ mac_set.3 mac_set_proc.3 \ diff --git a/lib/libc/posix1e/mac.3 b/lib/libc/posix1e/mac.3 index f806dac..ce82aa1 100644 --- a/lib/libc/posix1e/mac.3 +++ b/lib/libc/posix1e/mac.3 @@ -125,8 +125,10 @@ support for POSIX.1e interfaces and features is .Ud . .Sh SEE ALSO +.Xr mac 3 , .Xr mac_free 3 , .Xr mac_get 3 , +.Xr mac_prepare 3 , .Xr mac_set 3 , .Xr mac_text 3 , .Xr mac 9 diff --git a/lib/libc/posix1e/mac_free.3 b/lib/libc/posix1e/mac_free.3 index c65eb28..8c1aab6 100644 --- a/lib/libc/posix1e/mac_free.3 +++ b/lib/libc/posix1e/mac_free.3 @@ -61,8 +61,10 @@ function. .Sh SEE ALSO .Xr mac 3 , .Xr mac_get 3 , +.Xr mac_prepare 3 , .Xr mac_set 3 , -.Xr mac_text 3 +.Xr mac_text 3 , +.Xr mac 9 .Sh STANDARDS POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion of the draft diff --git a/lib/libc/posix1e/mac_get.3 b/lib/libc/posix1e/mac_get.3 index 1b679ee..dbaf053 100644 --- a/lib/libc/posix1e/mac_get.3 +++ b/lib/libc/posix1e/mac_get.3 @@ -15,9 +15,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote -.\" products derived from this software without specific prior written -.\" permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -45,21 +42,25 @@ .Lb libc .Sh SYNOPSIS .In sys/mac.h -.Ft mac_t -.Fn mac_get_file "const char *path_p" -.Ft mac_t -.Fn mac_get_fd "int fd" -.Ft mac_t -.Fn mac_get_proc +.Ft int +.Fn mac_get_file "const char *path" "mac_t label" +.Ft int +.Fn mac_get_fd "int fd" "mac_t label" +.Ft int +.Fn mac_get_pid "pid_t pid" "mac_t label" +.Ft int +.Fn mac_get_proc "mac_t label" .Sh DESCRIPTION The .Fn mac_get_file and .Fn mac_get_fd -functions return the MAC label associated -with the file referenced by -the pathname pointed to by -.Fa path_p +functions fill in +.Fa label +(which must first be allocated by +.Xr mac_prepare 3 ) +with the MAC label associated with the file referenced by +.Fa path or the file descriptor specified by .Fa fd , respectively. @@ -67,42 +68,52 @@ Note that this function will fail on socket descriptors. For information on getting MAC labels on socket descriptors see .Xr getsockopt 2 . +.Pp The .Fn mac_get_proc -function returns a MAC label associated -with the requesting process. +and +.Fn mac_get_pid +functions fill in +.Fa label +(which must first be allocated by +.Xr mac_prepare 3 ) +with the MAC label associated +with the requesting process +or the specified process, respectively. .Sh ERRORS .Bl -tag -width Er .It Bq Er EACCES A component of -.Fa path_p +.Fa path is not searchable, or MAC read access to the file is denied. .It Bq Er ENAMETOOLONG The pathname pointed to by -.Fa path_p +.Fa path exceeds .Dv PATH_MAX , or a component of the pathname exceeds .Dv NAME_MAX . .It Bq Er ENOENT A component of -.Fa path_p +.Fa path does not exist. .It Bq Er ENOMEM Insufficient memory is available to allocate a new MAC label structure. .It Bq Er ENOTDIR A component of -.Fa path_p +.Fa path is not a directory. .El .Sh SEE ALSO .Xr mac 3 , .Xr mac_free 3 , +.Xr mac_text 3 , +.Xr mac_prepare 3 , .Xr mac_set 3 , -.Xr mac_text 3 +.Xr mac 9 .Sh STANDARDS POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion of the draft diff --git a/lib/libc/posix1e/mac_is_present.3 b/lib/libc/posix1e/mac_is_present.3 index 0db0a99..408ccda 100644 --- a/lib/libc/posix1e/mac_is_present.3 +++ b/lib/libc/posix1e/mac_is_present.3 @@ -15,9 +15,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote -.\" products derived from this software without specific prior written -.\" permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -74,4 +71,10 @@ is not valid. Insufficient memory was available to allocate internal storage. .El .Sh SEE ALSO -.Xr mac 3 +.Xr mac 3 , +.Xr mac_free 3 , +.Xr mac_get 3 , +.Xr mac_prepare 3 , +.Xr mac_set 3 , +.Xr mac_text 3 , +.Xr mac 9 diff --git a/lib/libc/posix1e/mac_is_present_np.3 b/lib/libc/posix1e/mac_is_present_np.3 index 0db0a99..408ccda 100644 --- a/lib/libc/posix1e/mac_is_present_np.3 +++ b/lib/libc/posix1e/mac_is_present_np.3 @@ -15,9 +15,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote -.\" products derived from this software without specific prior written -.\" permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -74,4 +71,10 @@ is not valid. Insufficient memory was available to allocate internal storage. .El .Sh SEE ALSO -.Xr mac 3 +.Xr mac 3 , +.Xr mac_free 3 , +.Xr mac_get 3 , +.Xr mac_prepare 3 , +.Xr mac_set 3 , +.Xr mac_text 3 , +.Xr mac 9 diff --git a/lib/libc/posix1e/mac_set.3 b/lib/libc/posix1e/mac_set.3 index 3f15726..34e1b34 100644 --- a/lib/libc/posix1e/mac_set.3 +++ b/lib/libc/posix1e/mac_set.3 @@ -85,7 +85,7 @@ and its effective user ID is equal to the owner of the file, or has appropriate privileges. .Sh RETURN VALUES -.Rv -std mac_set_fd mac_set_file mac_set_proc +.Rv -std mac_set_fd mac_set_file mac_set_link mac_set_proc .Sh ERRORS .Bl -tag -width Er .It Bq Er EACCES @@ -133,4 +133,6 @@ is not a directory. .Xr mac 3 , .Xr mac_free 3 , .Xr mac_get 3 , +.Xr mac_is_present_np 3 , +.Xr mac_prepare 3 , .Xr mac_text 3 diff --git a/lib/libc/posix1e/mac_text.3 b/lib/libc/posix1e/mac_text.3 index f5f38e0..df6c070 100644 --- a/lib/libc/posix1e/mac_text.3 +++ b/lib/libc/posix1e/mac_text.3 @@ -15,9 +15,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote -.\" products derived from this software without specific prior written -.\" permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -85,6 +82,8 @@ to allocate internal storage. .Xr mac 3 , .Xr mac_free 3 , .Xr mac_get 3 , +.Xr mac_is_present_np 3 , +.Xr mac_prepare 3 , .Xr mac_set 3 , .Xr maclabel 7 .Sh STANDARDS -- cgit v1.1