186 lines
4.7 KiB
HTML
186 lines
4.7 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of selabel_open</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>selabel_open</H1>
|
|
Section: SELinux API documentation (3)<BR>Updated: 18 Jun 2007<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
selabel_open, selabel_close - userspace SELinux labeling interface
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/selinux/selinux.h">selinux/selinux.h</A>></B>
|
|
|
|
<BR>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/selinux/label.h">selinux/label.h</A>></B>
|
|
|
|
<P>
|
|
<B>struct selabel_handle *selabel_open(int </B><I>backend</I><B>,</B>
|
|
|
|
|
|
<B>const struct selinux_opt *</B><I>options</I><B>,</B>
|
|
|
|
<BR>
|
|
|
|
<B>unsigned </B><I>nopt</I><B>);</B>
|
|
|
|
|
|
<P>
|
|
<B>void selabel_close(struct selabel_handle *</B><I>hnd</I><B>);</B>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>selabel_open</B>()
|
|
|
|
is used to initialize a labeling handle to be used for lookup operations. The
|
|
<I>backend</I>
|
|
|
|
argument specifies which backend is to be opened; the list of current backends appears in
|
|
<B>BACKENDS</B>
|
|
|
|
below.
|
|
<P>
|
|
The
|
|
<I>options</I>
|
|
|
|
argument should be NULL or a pointer to an array of
|
|
<B>selinux_opt</B>
|
|
|
|
structures of length
|
|
<I>nopt</I>:
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="1"><DD>
|
|
|
|
|
|
<PRE>
|
|
struct selinux_opt {
|
|
int type;
|
|
const char *value;
|
|
};
|
|
</PRE>
|
|
|
|
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
The available option types are described in
|
|
<B>GLOBAL OPTIONS</B>
|
|
|
|
below as well as in the documentation for each individual backend. The return value on success is a non-NULL value for use in subsequent label operations.
|
|
<P>
|
|
<B>selabel_close</B>()
|
|
|
|
terminates use of a handle, freeing any internal resources associated with it. After this call has been made, the handle must not be used again.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>GLOBAL OPTIONS</H2>
|
|
|
|
Global options which may be passed to
|
|
<B>selabel_open</B>()
|
|
|
|
include the following:
|
|
<DL COMPACT>
|
|
<DT id="2"><B>SELABEL_OPT_UNUSED</B>
|
|
|
|
<DD>
|
|
The option with a type code of zero is a no-op. Thus an array of options may be initizalized to zero and any untouched elements will not cause an error.
|
|
<DT id="3"><B>SELABEL_OPT_VALIDATE</B>
|
|
|
|
<DD>
|
|
A non-null value for this option enables context validation. By default,
|
|
<B><A HREF="/cgi-bin/man/man2html?3+security_check_context">security_check_context</A></B>(3)
|
|
|
|
is used; a custom validation function can be provided via
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_set_callback">selinux_set_callback</A></B>(3).
|
|
|
|
Note that an invalid context may not be treated as an error unless it is actually encountered during a lookup operation.
|
|
<DT id="4"><B>SELABEL_OPT_DIGEST</B>
|
|
|
|
<DD>
|
|
A non-null value for this option enables the generation of an SHA1 digest of
|
|
the spec files loaded as described in
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selabel_digest">selabel_digest</A></B>(3)
|
|
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>BACKENDS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="5"><B>SELABEL_CTX_FILE</B>
|
|
|
|
<DD>
|
|
File contexts backend, described in
|
|
<B><A HREF="/cgi-bin/man/man2html?5+selabel_file">selabel_file</A></B>(5).
|
|
|
|
<DT id="6"><B>SELABEL_CTX_MEDIA</B>
|
|
|
|
<DD>
|
|
Media contexts backend, described in
|
|
<B><A HREF="/cgi-bin/man/man2html?5+selabel_media">selabel_media</A></B>(5).
|
|
|
|
<DT id="7"><B>SELABEL_CTX_X</B>
|
|
|
|
<DD>
|
|
X Windows contexts backend, described in
|
|
<B><A HREF="/cgi-bin/man/man2html?5+selabel_x">selabel_x</A></B>(5).
|
|
|
|
<DT id="8"><B>SELABEL_CTX_DB</B>
|
|
|
|
<DD>
|
|
Database objects contexts backend, described in
|
|
<B><A HREF="/cgi-bin/man/man2html?5+selabel_db">selabel_db</A></B>(5).
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
A non-NULL handle value is returned on success. On error, NULL is returned and
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Eamon Walsh <<A HREF="mailto:ewalsh@tycho.nsa.gov">ewalsh@tycho.nsa.gov</A>>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selabel_lookup">selabel_lookup</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selabel_stats">selabel_stats</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_set_callback">selinux_set_callback</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+selinux">selinux</A></B>(8)
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="9"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="10"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="11"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="12"><A HREF="#lbAE">GLOBAL OPTIONS</A><DD>
|
|
<DT id="13"><A HREF="#lbAF">BACKENDS</A><DD>
|
|
<DT id="14"><A HREF="#lbAG">RETURN VALUE</A><DD>
|
|
<DT id="15"><A HREF="#lbAH">AUTHOR</A><DD>
|
|
<DT id="16"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:56 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|