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

113 lines
3.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of getfscreatecon</TITLE>
</HEAD><BODY>
<H1>getfscreatecon</H1>
Section: SELinux API documentation (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>
getfscreatecon, setfscreatecon - get or set the SELinux security context used for creating a new file system object
<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>
<P>
<B>int getfscreatecon(char **</B><I>con</I><B>);</B>
<P>
<B>int getfscreatecon_raw(char **</B><I>con</I><B>);</B>
<P>
<B>int setfscreatecon(char *</B><I>context</I><B>);</B>
<P>
<B>int setfscreatecon_raw(char *</B><I>context</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>getfscreatecon</B>()
retrieves the context used for creating a new file system object.
This returned context should be freed with
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3)
if non-NULL.
<B>getfscreatecon</B>()
sets *con to NULL if no fscreate context has been explicitly
set by the program (i.e. using the default policy behavior).
<P>
<B>setfscreatecon</B>()
sets the context used for creating a new file system object.
NULL can be passed to
<B>setfscreatecon</B>()
to reset to the default policy behavior.
The fscreate context is automatically reset after the next
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2),
so a program doesn't need to explicitly sanitize it upon startup.
<P>
<B>setfscreatecon</B>()
can be applied prior to library
functions that internally perform an file creation,
in order to set an file context on the objects.
<P>
<B>getfscreatecon_raw</B>()
and
<B>setfscreatecon_raw</B>()
behave identically to their non-raw counterparts but do not perform context
translation.
<P>
<B>Note:</B>
Signal handlers that perform a
<B>setfscreatecon</B>()
must take care to
save, reset, and restore the fscreate context to avoid unexpected behavior.
<P>
<BR>
<B>Note:</B>
Contexts are thread specific.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On error -1 is returned.
On success 0 is returned.
<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+freecon">freecon</A></B>(3), <B><A HREF="/cgi-bin/man/man2html?3+getcon">getcon</A></B>(3), <B><A HREF="/cgi-bin/man/man2html?3+getexeccon">getexeccon</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>