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

193 lines
4.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of selinux_set_callback</TITLE>
</HEAD><BODY>
<H1>selinux_set_callback</H1>
Section: SELinux API documentation (3)<BR>Updated: 20 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>
selinux_set_callback - userspace SELinux callback facilities
<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>void selinux_set_callback(int </B><I>type</I><B>, union selinux_callback </B><I>callback</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>selinux_set_callback</B>()
sets the callback indicated by
<I>type</I>
to the value of
<I>callback</I>,
which should be passed as a function pointer cast to type
<B>union</B>
<B>selinux_callback</B>.
<P>
All callback functions should return a negative value with
<I>errno</I>
set appropriately on error.
<P>
The available values for
<I>type</I>
are:
<DL COMPACT>
<DT id="1"><B>SELINUX_CB_LOG</B>
<DD>
<B>int (*</B><I>func_log</I><B>) (int </B><I>type</I><B>, const char *</B><I>fmt</I><B>, ...);</B>
<P>
This callback is used for logging and should process the
<B><A HREF="/cgi-bin/man/man2html?3+printf">printf</A></B>(3)
style
<I>fmt</I>
string and arguments as appropriate. The
<I>type</I>
argument indicates the type of message and will be set to one of the following:
<P>
<B>SELINUX_ERROR</B>
<P>
<B>SELINUX_WARNING</B>
<P>
<B>SELINUX_INFO</B>
<P>
<B>SELINUX_AVC</B>
<DT id="2"><B>SELINUX_CB_AUDIT</B>
<DD>
<B>int (*</B><I>func_audit</I><B>) (void *</B><I>auditdata</I><B>, security_class_t </B><I>cls</I><B>,</B>
<B>char *</B><I>msgbuf</I><B>, size_t </B><I>msgbufsize</I><B>);</B>
<P>
This callback is used for supplemental auditing in AVC messages. The
<I>auditdata</I>
and
<I>cls</I>
arguments are the values passed to
<B><A HREF="/cgi-bin/man/man2html?3+avc_has_perm">avc_has_perm</A></B>(3).
A human-readable interpretation should be printed to
<I>msgbuf</I>
using no more than
<I>msgbufsize</I>
characters.
<DT id="3"><B>SELINUX_CB_VALIDATE</B>
<DD>
<B>int (*</B><I>func_validate</I><B>) (char **</B><I>ctx</I><B>);</B>
<P>
This callback is used for context validation. The callback may optionally modify the input context by setting the target of the
<I>ctx</I>
pointer to a new context. In this case, the old value should be freed with
<B><A HREF="/cgi-bin/man/man2html?3+freecon">freecon</A></B>(3).
The value of
<I>errno</I>
should be set to
<B>EINVAL</B>
to indicate an invalid context.
<DT id="4"><B>SELINUX_CB_SETENFORCE</B>
<DD>
<B>int (*</B><I>func_setenforce</I><B>) (int </B><I>enforcing</I><B>);</B>
<P>
This callback is invoked when the system enforcing state changes.
The
<I>enforcing</I>
argument indicates the new value and is set to
<I>1</I>
for enforcing mode, and
<I>0</I>
for permissive mode.
<DT id="5"><B>SELINUX_CB_POLICYLOAD</B>
<DD>
<B>int (*</B><I>func_policyload</I><B>) (int </B><I>seqno</I><B>);</B>
<P>
This callback is invoked when the system security policy is reloaded.
The
<I>seqno</I>
argument is the current sequential number of the policy generation in the system.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
None.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
None.
<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+avc_init">avc_init</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+avc_netlink_open">avc_netlink_open</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="6"><A HREF="#lbAB">NAME</A><DD>
<DT id="7"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="8"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="9"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="10"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="11"><A HREF="#lbAG">AUTHOR</A><DD>
<DT id="12"><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>