148 lines
3.4 KiB
HTML
148 lines
3.4 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of context_new</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>context_new</H1>
|
|
Section: SELinux API documentation (3)<BR>Updated: 20 December 2011<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>
|
|
|
|
context_new, context_str, context_free, context_type_get, context_type_set, context_range_get, context_range_set,context_role_get, context_role_set, context_user_get, context_user_set - Routines to manipulate SELinux security contexts
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/selinux/context.h">selinux/context.h</A>></B>
|
|
|
|
<P>
|
|
<B>context_t context_new(const char *</B><I>context_str</I><B>);</B>
|
|
|
|
<P>
|
|
<B>const char * context_str(context_t </B><I>con</I><B>);</B>
|
|
|
|
<P>
|
|
<B>void context_free(context_t </B><I>con</I><B>);</B>
|
|
|
|
<P>
|
|
<B>const char * context_type_get(context_t </B><I>con</I><B>);</B>
|
|
|
|
<P>
|
|
<B>const char * context_range_get(context_t </B><I>con</I><B>);</B>
|
|
|
|
<P>
|
|
<B>const char * context_role_get(context_t </B><I>con</I><B>);</B>
|
|
|
|
<P>
|
|
<B>const char * context_user_get(context_t </B><I>con</I><B>);</B>
|
|
|
|
<P>
|
|
<B>int context_type_set(context_t </B><I>con</I><B>, const char *</B><I>type</I><B>);</B>
|
|
|
|
<P>
|
|
<B>int context_range_set(context_t </B><I>con</I><B>, const char *</B><I>range</I><B>);</B>
|
|
|
|
<P>
|
|
<B>int context_role_set(context_t </B><I>con</I><B>, const char *</B><I>role</I><B>);</B>
|
|
|
|
<P>
|
|
<B>int context_user_set(context_t </B><I>con</I><B>, const char *</B><I>user</I><B>);</B>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
These functions allow an application to manipulate the fields of a
|
|
security context string without requiring it to know the format of the
|
|
string.
|
|
<P>
|
|
<B>context_new</B>()
|
|
|
|
returns a new context initialized to a context string.
|
|
<P>
|
|
<B>context_str</B>()
|
|
|
|
returns a pointer to the string value of the
|
|
<B>context_t</B>,
|
|
|
|
valid until the next call to
|
|
<B>context_str</B>()
|
|
|
|
or
|
|
<B>context_free</B>()
|
|
|
|
for the same
|
|
<B>context_t*</B>.
|
|
|
|
<P>
|
|
<B>context_free</B>()
|
|
|
|
frees the storage used by a context.
|
|
<P>
|
|
<B>context_type_get</B>(),
|
|
|
|
<B>context_range_get</B>(),
|
|
|
|
<B>context_role_get</B>(),
|
|
|
|
<B>context_user_get</B>()
|
|
|
|
get a pointer to the string value of a context component.
|
|
<P>
|
|
<B>Note:</B>
|
|
|
|
Values returned by the get functions are only valid until the next call
|
|
to a set function or
|
|
<B>context_free</B>()
|
|
|
|
for the same
|
|
<B>context_t</B>
|
|
|
|
structure.
|
|
<P>
|
|
<B>context_type_set</B>(),
|
|
|
|
<B>context_range_set</B>(),
|
|
|
|
<B>context_role_set</B>(),
|
|
|
|
<B>context_user_set</B>()
|
|
|
|
set a context component.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On failure
|
|
<B>context_*_set</B>()
|
|
|
|
functions return non-zero and 0 on success.
|
|
<P>
|
|
The other functions return NULL on failure and non-NULL on success.
|
|
<P>
|
|
On failure
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<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="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:38 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|