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

185 lines
5.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of get_ordered_context_list</TITLE>
</HEAD><BODY>
<H1>get_ordered_context_list</H1>
Section: SELinux (3)<BR>Updated: 1 January 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>
get_ordered_context_list, get_ordered_context_list_with_level, get_default_context, get_default_context_with_level, get_default_context_with_role, get_default_context_with_rolelevel, query_user_context, manual_user_enter_context, get_default_role - determine SELinux context(s) for user sessions
<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/get_context_list.h">selinux/get_context_list.h</A>&gt;</B>
<P>
<B>int get_ordered_context_list(const char *</B><I>user</I><B>, char *</B><I>fromcon</I><B>, char ***</B><I>list</I><B>);</B>
<P>
<B>int get_ordered_context_list_with_level(const char *</B><I>user</I><B>, const char *</B><I>level</I><B>, char *</B><I>fromcon</I><B>, char ***</B><I>list</I><B>);</B>
<P>
<B>int get_default_context(const char *</B><I>user</I><B>, char *</B><I>fromcon</I><B>, char **</B><I>newcon</I><B>);</B>
<P>
<B>int get_default_context_with_level(const char *</B><I>user</I><B>, const char *</B><I>level</I><B>, char *</B><I>fromcon</I><B>, char **</B><I>newcon</I><B>);</B>
<P>
<B>int get_default_context_with_role(const char *</B><I>user</I><B>, const char *</B><I>role</I><B>, char *</B><I>fromcon</I><B>, char **</B><I>newcon</I><B>);</B>
<P>
<B>int get_default_context_with_rolelevel(const char *</B><I>user</I><B>, const char *</B><I>role</I><B>, const char *</B><I>level</I><B>, char *</B><I>fromcon</I><B>, char **</B><I>newcon</I><B>);</B>
<P>
<B>int query_user_context(char **</B><I>list</I><B>, char **</B><I>newcon</I><B>);</B>
<P>
<B>int manual_user_enter_context(const char *</B><I>user</I><B>, char **</B><I>newcon</I><B>);</B>
<P>
<B>int get_default_type(const char *</B><I>role</I><B>, char **</B><I>type</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>get_ordered_context_list</B>()
invokes the
<B><A HREF="/cgi-bin/man/man2html?3+security_compute_user">security_compute_user</A></B>(3)
function to obtain the list of contexts for the specified
<I>user</I>
that are reachable from the specified
<I>fromcon</I>
context. The function then orders the resulting list based on the global
<I>/etc/selinux/{SELINUXTYPE}/contexts/default_contexts</I>
file and the per-user
<I>/etc/selinux/{SELINUXTYPE}/contexts/users/&lt;username&gt;</I>
file if it exists. The
<I>fromcon</I>
parameter may be NULL to indicate that the current context should
be used. The function returns the number of contexts in the
list, or -1 upon errors. The list must be freed using the
<B><A HREF="/cgi-bin/man/man2html?3+freeconary">freeconary</A></B>(3)
function.
<P>
<B>get_ordered_context_list_with_level</B>()
invokes the
<B>get_ordered_context_list</B>()
function and applies the specified level.
<P>
<B>get_default_context</B>()
is the same as
<B>get_ordered_context_list</B>()
but only returns a single context
which has to be freed with
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3).
<P>
<B>get_default_context_with_level</B>()
invokes the
<B>get_default_context</B>()
function and applies the specified level.
<P>
<B>get_default_context_with_role</B>()
is the same as
<B>get_default_context</B>()
but only returns a context with the specified role, returning -1 if no
such context is reachable for the user.
<P>
<B>get_default_context_with_rolelevel</B>()
invokes the
<B>get_default_context_with_role</B>()
function and applies the specified level.
<P>
<B>query_user_context</B>()
takes a list of contexts, queries the user via stdin/stdout as to which context
they want, and returns a new context as selected by the user (which has to be
freed with
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3)).
<P>
<B>manual_user_enter_context</B>()
allows the user to manually enter a context as a fallback if a list of
authorized contexts could not be obtained. Caller must free via
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3).
<P>
<B>get_default_type</B>()
Get the default type (domain) for
<I>role</I>
and set
<I>type</I>
to refer to it, which has to be freed with free.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<B>get_ordered_context_list</B>()
and
<B>get_ordered_context_list_with_level</B>()
return the number of contexts in the list upon success or -1 upon errors.
The other functions return 0 for success or -1 for errors.
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?8+selinux">selinux</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?3+freeconary">freeconary</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+security_compute_av">security_compute_av</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+getseuserbyname">getseuserbyname</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="4"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="5"><A HREF="#lbAF">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:44 GMT, March 31, 2021
</BODY>
</HTML>