Skip to contentSkip to conversation

libselinux: Updated selabel_media(5) man page

PATCH Applied Richard Haines 2 participants 2 messages Dec 1, 2011 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: Updated selabel_media(5) man page

Updated selabel_media(5) with media context configuration file format and added media(5) man page that links to it.

---
 libselinux/man/man5/media.5         |    1 +
 libselinux/man/man5/selabel_media.5 |   86 ++++++++++++++++++++++++++++-------
 2 files changed, 70 insertions(+), 17 deletions(-)
 create mode 100644 libselinux/man/man5/media.5
libselinux/man/man5/media.5 new file +1 -0
new file mode 100644
index 0000000..14f00f2
@@ -0,0 +1 @@
+.so man5/selabel_media.5
libselinux/man/man5/selabel_media.5 +69 -17

106 lines not on this page · raw message

Signature · 10 lines
1.7.7.1





--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Applied
#1 lore raw

Applied to devel branch.

Quoted 135 lines · Richard Haines

Updated selabel_media(5) with media context configuration file format and added media(5) man page that links to it.

---
 libselinux/man/man5/media.5         |    1 + libselinux/man/man5/selabel_media.5 |   86 ++++++++++++++++++++++++++++-------

 2 files changed, 70 insertions(+), 17 deletions(-)

 create mode 100644 libselinux/man/man5/media.5

libselinux/man/man5/media.5 new file +1 -0
new file mode 100644
index 0000000..14f00f2
@@ -0,0 +1 @@
+.so man5/selabel_media.5
libselinux/man/man5/selabel_media.5 +0 -0
index 796260f..0df1961 100644
@@ -1,37 +1,89 @@

 .\" Hey Emacs! This file is -*- nroff -*- source.
 .\"
 .\" Author: Eamon Walsh ([email protected]) 2007
-.TH "selabel_media" "5" "18 Jun 2007" "" "SELinux API documentation"
+.TH "selabel_media" "5" "29 Nov 2011" "Security Enhanced Linux" "SELinux API documentation" .SH "NAME"

libselinux/man/man5/selabel_media.5 +2 -3
-selabel_media \- userspace SELinux labeling interface: media contexts backend.
-.SH "SYNOPSIS"
-.B #include <selinux/selinux.h>
+selabel_media \- userspace SELinux labeling interface and configuration file format for the media contexts backend.
 
+.SH "SYNOPSIS"

 .B #include <selinux/label.h>
 .sp
 .BI "int selabel_lookup(struct selabel_handle *" hnd , .in +\w'int selabel_lookup('u
 .BI "security_context_t *" context ,
-
+.br
+.BI "const char *" device_name ", int " unused ");" +.in
+.sp
+.BI "int selabel_lookup_raw(struct selabel_handle *" hnd , +.in +\w'int selabel_lookup('u
+.BI "security_context_t *" context ,
+.br
 .BI "const char *" device_name ", int " unused ");"

 .SH "DESCRIPTION"

libselinux/man/man5/selabel_media.5 +4 -2
-The media contexts backend maps from media device names such as "cdrom" or "floppy" into security contexts.  It is used to find the appropriate context for establishing context mounts on these devices.
-
+The media contexts backend maps from media device names such as "cdrom" or "floppy" into security contexts. It is used to find the appropriate context for establishing context mounts on these devices. The returned \fIcontext\fR must be freed using \fBfreecon\fR(3).
+.br
+\fBselabel_lookup\fR(3) describes the function with its return and error codes.
+.sp

 The integer lookup argument is currently unused and should be set to zero. +.sp

libselinux/man/man5/selabel_media.5 +6 -0
+Any messages generated by \fBselabel_lookup\fR are sent to \fIstderr\fR by default, although this can be changed by \fBselinux_set_callback\fR(3).
+.sp
+.B selabel_lookup_raw
+behaves identically to \fBselabel_lookup\fR but does not perform context translation.
+.sp
+The \fBFILES\fR section details the configuration files used to determine the media context.

 .SH "OPTIONS"

libselinux/man/man5/selabel_media.5 +1 -4
-In addition to the global options described in
-.BR selabel_open (3),
-this backend recognizes the following options:
-
+In addition to the global options described in \fBselabel_open\fR(3), this backend recognizes the following options:

 .TP
 .B SELABEL_OPT_PATH

libselinux/man/man5/selabel_media.5 +46 -7
-A non-null value for this option specifies a path to a file that will be opened in lieu of the standard media contexts file.
+A non-null value for this option specifies a path to a file that will be opened in lieu of the standard \fImedia\fR contexts file.
 
-.SH "SEE ALSO"
-.BR selabel_open (3),
-.BR selabel_lookup (3),
-.BR selabel_stats (3),
-.BR selinux (8)
+.SH "FILES"
+The media context file used to retrieve a default context depends on the \fBSELABEL_OPT_PATH\fR parameter passed to \fBselabel_open\FR(3). If \fINULL\fR, then the \fBSELABEL_OPT_PATH\fR value will default to the active policy media contexts location (as returned by \fBselinux_media_context_path\fR(3)), otherwise the actual \fBSELABEL_OPT_PATH\fR value specified is used.
+.sp
+The default media contexts file is:
+.RS
+.I /etc/selinux/{SELINUXTYPE}/contexts/files/media
+.RE
+.sp
+Where \fI{SELINUXTYPE}\fR is the entry from the selinux configuration file \fIconfig\fR (see \fBselinux_config\fR(5)).
+.sp
+Should there not be a valid entry in the \fImedia\fR file, then the default \fIremovable_context\fR file will be read (see \fBremovable_context\fR(5)).
 
+.SH "FILE FORMAT"
+Each line within the \fImedia\fR file is as follows:
+.RS
+.I device_name context
+.RE
+.sp
+Where:
+.RS
+.I device_name
+.RS
+The media identifier (e.g. cdrom, floppy, disk and usb).
+.RE
+.I context
+.RS
+The context to be used for labeling the device.
+.RE
+.RE
+.sp
+Example:
+.RS
+# contexts/files/media
+.br
+cdrom system_u:object_r:removable_device_t
+.br
+floppy system_u:object_r:removable_device_t
+.br
+disk system_u:object_r:fixed_disk_device_t
+
+.SH "NOTES"
+If contexts are to be validated, then the global option \fBSELABEL_OPT_VALIDATE\fR must be set before calling \fBselabel_open\fR(3). If
+this is not set, then it is possible for an invalid context to be returned.
+
+.SH "SEE ALSO"
+.BR selinux "(8), " selabel_open "(3), " selabel_lookup "(3), " selabel_stats "(3), " selabel_close "(3), " selinux_set_callback "(3), " selinux_media_context_path "(3), " freecon "(3), " selinux_config "(5), " removable_context "(5) "
--

1.7.7.1

Quoted 4 lines

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.