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

140 lines
3.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of avc_context_to_sid</TITLE>
</HEAD><BODY>
<H1>avc_context_to_sid</H1>
Section: SELinux API documentation (3)<BR>Updated: 27 May 2004<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>
avc_context_to_sid, avc_sid_to_context, avc_get_initial_sid - obtain and manipulate SELinux security ID's
<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/avc.h">selinux/avc.h</A>&gt;</B>
<P>
<B>int avc_context_to_sid(char *</B><I>ctx</I><B>, security_id_t *</B><I>sid</I><B>);</B>
<P>
<B>int avc_sid_to_context(security_id_t </B><I>sid</I><B>, char **</B><I>ctx</I><B>);</B>
<P>
<B>int avc_get_initial_sid(const char *</B><I>name</I><B>, security_id_t *</B><I>sid</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Security ID's (SID's) are opaque representations of security contexts, managed by the userspace AVC.
<P>
<B>avc_context_to_sid</B>()
returns a SID for the given
<I>context</I>
in the memory referenced by
<I>sid</I>.
<P>
<B>avc_sid_to_context</B>()
returns a copy of the context represented by
<I>sid</I>
in the memory referenced by
<I>ctx</I>.
The user must free the copy with
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3).
<P>
<B>avc_get_initial_sid</B>()
returns a SID for the kernel initial security identifier specified by
<I>name</I>.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<B>avc_context_to_sid</B>()
and
<B>avc_sid_to_context</B>()
return zero on success. 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>ENOMEM</B>
<DD>
An attempt to allocate memory failed.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>
As of libselinux version 2.0.86, SID's are no longer reference counted. A SID will be valid from the time it is first obtained until the next call to
<B><A HREF="/cgi-bin/man/man2html?3+avc_destroy">avc_destroy</A></B>(3).
The
<B><A HREF="/cgi-bin/man/man2html?3+sidget">sidget</A></B>(3)
and
<B><A HREF="/cgi-bin/man/man2html?3+sidput">sidput</A></B>(3)
functions, formerly used to adjust the reference count, are no-ops and are deprecated.
<A NAME="lbAH">&nbsp;</A>
<H2>AUTHOR</H2>
Eamon Walsh &lt;<A HREF="mailto:ewalsh@tycho.nsa.gov">ewalsh@tycho.nsa.gov</A>&gt;
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+avc_init">avc_init</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+avc_has_perm">avc_has_perm</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+avc_cache_stats">avc_cache_stats</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+avc_add_callback">avc_add_callback</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+getcon">getcon</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</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="2"><A HREF="#lbAB">NAME</A><DD>
<DT id="3"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="4"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="5"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="6"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="7"><A HREF="#lbAG">NOTES</A><DD>
<DT id="8"><A HREF="#lbAH">AUTHOR</A><DD>
<DT id="9"><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:36 GMT, March 31, 2021
</BODY>
</HTML>