280 lines
5.9 KiB
HTML
280 lines
5.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of selinux_restorecon_xattr</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>selinux_restorecon_xattr</H1>
|
|
Section: SELinux API documentation (3)<BR>Updated: 30 July 2016<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<P>
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
selinux_restorecon_xattr - manage default
|
|
<I>security.sehash</I>
|
|
|
|
extended attribute entries added by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon">selinux_restorecon</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+setfiles">setfiles</A></B>(8)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?8+restorecon">restorecon</A></B>(8).
|
|
|
|
<P>
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/selinux/restorecon.h">selinux/restorecon.h</A>></B>
|
|
|
|
<P>
|
|
<B>int selinux_restorecon_xattr(const char *</B><I>pathname</I><B>,</B>
|
|
|
|
|
|
<BR>
|
|
|
|
<B>unsigned int </B><I>xattr_flags</I><B>,</B>
|
|
|
|
<BR>
|
|
|
|
<B>struct dir_xattr ***</B><I>xattr_list</I><B>);</B>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>selinux_restorecon_xattr</B>()
|
|
|
|
returns a linked list of
|
|
<B>dir_xattr</B>
|
|
|
|
structures containing information described below based on:
|
|
<P>
|
|
<DL COMPACT><DT id="1"><DD>
|
|
<I>pathname</I>
|
|
|
|
containing a directory tree to be searched for
|
|
<I>security.sehash</I>
|
|
|
|
extended attribute entries.
|
|
<P>
|
|
<I>xattr_flags</I>
|
|
|
|
contains options as follows:
|
|
<P>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
<P>
|
|
<B>SELINUX_RESTORECON_XATTR_RECURSE</B>
|
|
|
|
recursively descend directories.
|
|
<P>
|
|
<B>SELINUX_RESTORECON_XATTR_DELETE_NONMATCH_DIGESTS</B>
|
|
|
|
delete non-matching digests from each directory in
|
|
<I>pathname</I>.
|
|
|
|
<P>
|
|
<B>SELINUX_RESTORECON_XATTR_DELETE_ALL_DIGESTS</B>
|
|
|
|
delete all digests from each directory in
|
|
<I>pathname</I>.
|
|
|
|
<P>
|
|
<B>SELINUX_RESTORECON_XATTR_IGNORE_MOUNTS</B>
|
|
|
|
do not read
|
|
<B>/proc/mounts</B>
|
|
|
|
to obtain a list of non-seclabel mounts to be excluded from the search.
|
|
<BR>
|
|
|
|
Setting
|
|
<B>SELINUX_RESTORECON_XATTR_IGNORE_MOUNTS</B>
|
|
|
|
is useful where there is a non-seclabel fs mounted with a seclabel fs mounted
|
|
on a directory below this.
|
|
</DL>
|
|
|
|
<P>
|
|
<I>xattr_list</I>
|
|
|
|
is the returned pointer to a linked list of
|
|
<B>dir_xattr</B>
|
|
|
|
structures, each containing the following information:
|
|
<P>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
|
|
|
|
<PRE>
|
|
struct dir_xattr {
|
|
char *directory;
|
|
char *digest; /* Printable hex encoded string */
|
|
enum digest_result result;
|
|
struct dir_xattr *next;
|
|
};
|
|
</PRE>
|
|
|
|
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
The
|
|
<B>result</B>
|
|
|
|
entry is enumerated as follows:
|
|
<DL COMPACT><DT id="4"><DD>
|
|
|
|
|
|
<PRE>
|
|
enum digest_result {
|
|
MATCH = 0,
|
|
NOMATCH,
|
|
DELETED_MATCH,
|
|
DELETED_NOMATCH,
|
|
ERROR
|
|
};
|
|
</PRE>
|
|
|
|
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
<I>xattr_list</I>
|
|
|
|
must be set to
|
|
<B>NULL</B>
|
|
|
|
before calling
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_xattr">selinux_restorecon_xattr</A></B>(3).
|
|
|
|
The caller is responsible for freeing the returned
|
|
<I>xattr_list</I>
|
|
|
|
entries in the linked list.
|
|
</DL>
|
|
|
|
<P>
|
|
See the
|
|
<B>NOTES</B>
|
|
|
|
section for more information.
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success, zero is returned. On error, -1 is returned and
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<P>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="5">1.<DD>
|
|
By default
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_xattr">selinux_restorecon_xattr</A></B>(3)
|
|
|
|
will use the default set of specfiles described in
|
|
<B><A HREF="/cgi-bin/man/man2html?5+files_contexts">files_contexts</A></B>(5)
|
|
|
|
to calculate the SHA1 digests to be used for comparison.
|
|
To change this default behavior
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selabel_open">selabel_open</A></B>(3)
|
|
|
|
must be called specifying the required
|
|
<B>SELABEL_OPT_PATH</B>
|
|
|
|
and setting the
|
|
<B>SELABEL_OPT_DIGEST</B>
|
|
|
|
option to a non-NULL value.
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_set_sehandle">selinux_restorecon_set_sehandle</A></B>(3)
|
|
|
|
is then called to set the handle to be used by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_xattr">selinux_restorecon_xattr</A></B>(3).
|
|
|
|
<DT id="6">2.<DD>
|
|
By default
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_xattr">selinux_restorecon_xattr</A></B>(3)
|
|
|
|
reads
|
|
<B>/proc/mounts</B>
|
|
|
|
to obtain a list of non-seclabel mounts to be excluded from searches unless the
|
|
<B>SELINUX_RESTORECON_XATTR_IGNORE_MOUNTS</B>
|
|
|
|
flag has been set.
|
|
<DT id="7">3.<DD>
|
|
<B>RAMFS</B>
|
|
|
|
and
|
|
<B>TMPFS</B>
|
|
|
|
filesystems do not support the
|
|
<I>security.sehash</I>
|
|
|
|
extended attribute and are automatically excluded from searches.
|
|
<DT id="8">4.<DD>
|
|
By default
|
|
<B>stderr</B>
|
|
|
|
is used to log output messages and errors. This may be changed by calling
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_set_callback">selinux_set_callback</A></B>(3)
|
|
|
|
with the
|
|
<B>SELINUX_CB_LOG</B>
|
|
|
|
<I>type</I>
|
|
|
|
option.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon">selinux_restorecon</A></B>(3)
|
|
|
|
<BR>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_set_sehandle">selinux_restorecon_set_sehandle</A></B>(3),
|
|
|
|
<BR>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_default_handle">selinux_restorecon_default_handle</A></B>(3),
|
|
|
|
<BR>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_set_exclude_list">selinux_restorecon_set_exclude_list</A></B>(3),
|
|
|
|
<BR>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_restorecon_set_alt_rootpath">selinux_restorecon_set_alt_rootpath</A></B>(3),
|
|
|
|
<BR>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+selinux_set_callback">selinux_set_callback</A></B>(3)
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="9"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="10"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="11"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="12"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="13"><A HREF="#lbAF">NOTES</A><DD>
|
|
<DT id="14"><A HREF="#lbAG">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>
|