man-pages/man3/selabel_lookup.3.html
2021-03-31 01:06:50 +01:00

146 lines
3.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of selabel_lookup</TITLE>
</HEAD><BODY>
<H1>selabel_lookup</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">&nbsp;</A>
<H2>NAME</H2>
selabel_lookup - obtain SELinux security context from a string label
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>#include &lt;<A HREF="file:///usr/include/selinux/selinux.h">selinux/selinux.h</A>&gt;</B>
<BR>
<B>#include &lt;<A HREF="file:///usr/include/selinux/label.h">selinux/label.h</A>&gt;</B>
<P>
<B>int selabel_lookup(struct selabel_handle *</B><I>hnd</I><B>,</B>
<B>char **</B><I>context</I><B>,</B>
<BR>
<B>const char *</B><I>key</I><B>, int </B><I>type</I><B>);</B>
<P>
<B>int selabel_lookup_raw(struct selabel_handle *</B><I>hnd</I><B>,</B>
<B>char **</B><I>context</I><B>,</B>
<BR>
<B>const char *</B><I>key</I><B>, int </B><I>type</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>selabel_lookup</B>()
performs a lookup operation on the handle
<I>hnd</I>,
returning the result in the memory pointed to by
<I>context</I>,
which must be freed by the caller using
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3).
The
<I>key</I>
and
<I>type</I>
parameters are the inputs to the lookup operation and are interpreted according to the specific backend that
<I>handle</I>
is open on.
<P>
<B>selabel_lookup_raw</B>()
behaves identically to
<B>selabel_lookup</B>()
but does not perform context translation.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success, zero is returned. On error, -1 is returned and
<I>errno</I>
is set appropriately.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="1"><B>ENOENT</B>
<DD>
No context corresponding to the input
<I>key</I>
and
<I>type</I>
was found.
<DT id="2"><B>EINVAL</B>
<DD>
The
<I>key</I>
and/or
<I>type</I>
inputs are invalid, or the context being returned failed validation.
<DT id="3"><B>ENOMEM</B>
<DD>
An attempt to allocate memory failed.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHOR</H2>
Eamon Walsh &lt;<A HREF="mailto:ewalsh@tycho.nsa.gov">ewalsh@tycho.nsa.gov</A>&gt;
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+selabel_open">selabel_open</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">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="7"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="8"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="9"><A HREF="#lbAG">AUTHOR</A><DD>
<DT id="10"><A HREF="#lbAH">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>