mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-13 17:44:54 +00:00
6ef13eeda7
- Add man page sections '(N)' to external references, and '()' on functions described in the same man page. - Escape minus signs when those are expected to be used on the command line or files. - Mark files and variables in italic; Note headings, function names, constants, program options and man page references in bold. - Do not justify and hyphenate SEE ALSO section, and avoid hyphenation on symbol names by prepending them with \%. - Remove trailing dot from NAME section description. - Split sections with a no-op command '.', to visually distinguish them but to avoid introducing spurious vertical space in the formatted output. - Add explicit .sp commands in the SYNOPSIS section between function prototypes, and fix space placement in function protoypes. - Split header includes with .br (instead of the explicit or implicit .sp) so that they are vertically contiguous. - Add missing {} around SELINUXTYPE and POLICYTYPE variable text in paths. - Remove unneeded formatting commands. - Remove spurious blank lines. Signed-off-by: Guillem Jover <guillem@debian.org> Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
93 lines
2.8 KiB
Groff
93 lines
2.8 KiB
Groff
.TH "matchpathcon" "3" "21 November 2009" "sds@tycho.nsa.gov" "SELinux API documentation"
|
|
.SH "NAME"
|
|
matchpathcon, matchpathcon_index \- get the default SELinux security context for the specified path from the file contexts configuration
|
|
.
|
|
.SH "SYNOPSIS"
|
|
.B #include <selinux/selinux.h>
|
|
.sp
|
|
.BI "int matchpathcon_init(const char *" path ");"
|
|
.sp
|
|
.BI "int matchpathcon_init_prefix(const char *" path ", const char *" subset ");"
|
|
.sp
|
|
.BI "int matchpathcon_fini(void);"
|
|
.sp
|
|
.BI "int matchpathcon(const char *" path ", mode_t " mode ", security_context_t *" con ");
|
|
.sp
|
|
.BI "int matchpathcon_index(const char *" name ", mode_t " mode ", security_context_t *" con ");"
|
|
.
|
|
.SH "DESCRIPTION"
|
|
.BR matchpathcon_init ()
|
|
loads the file contexts configuration specified by
|
|
.I path
|
|
into memory for use by subsequent
|
|
.BR matchpathcon ()
|
|
calls. If
|
|
.I path
|
|
is NULL, then the active file contexts configuration is loaded by default,
|
|
i.e. the path returned by
|
|
.BR selinux_file_context_path (3).
|
|
Unless the
|
|
.B MATCHPATHCON_BASEONLY
|
|
flag has been set via
|
|
.BR \%set_matchpathcon_flags (3),
|
|
files with the same path prefix but a
|
|
.B \%.homedirs
|
|
and
|
|
.B .local
|
|
suffix are also looked up and loaded if present. These files provide
|
|
dynamically generated entries for user home directories and for local
|
|
customizations.
|
|
|
|
.BR matchpathcon_init_prefix ()
|
|
is the same as
|
|
.BR matchpathcon_init ()
|
|
but only loads entries with regular expressions that have stems prefixed
|
|
by
|
|
.I \%prefix.
|
|
|
|
.BR matchpathcon_fini ()
|
|
frees the memory allocated by a prior call to
|
|
.BR matchpathcon_init. ()
|
|
This function can be used to free and reset the internal state between multiple
|
|
.BR matchpathcon_init ()
|
|
calls, or to free memory when finished using
|
|
.BR matchpathcon ().
|
|
|
|
.BR matchpathcon ()
|
|
matches the specified pathname and mode against the file contexts
|
|
configuration and sets the security context
|
|
.I con
|
|
to refer to the
|
|
resulting context. The caller must free the returned security context
|
|
.I con
|
|
using
|
|
.BR freecon (3)
|
|
when finished using it.
|
|
.I mode
|
|
can be 0 to disable mode matching, but
|
|
should be provided whenever possible, as it may affect the matching.
|
|
Only the file format bits (i.e. the file type) of the
|
|
.I mode
|
|
are used.
|
|
If
|
|
.BR matchpathcon_init ()
|
|
has not already been called, then this function will call it upon
|
|
its first invocation with a NULL
|
|
.I path,
|
|
defaulting to the active file contexts configuration.
|
|
|
|
.BR matchpathcon_index ()
|
|
is the same as
|
|
.BR matchpathcon ()
|
|
but returns a specification index that can later be used in a
|
|
.BR matchpathcon_filespec_add (3)
|
|
call.
|
|
.
|
|
.SH "RETURN VALUE"
|
|
Returns zero on success or \-1 otherwise.
|
|
.
|
|
.SH "SEE ALSO"
|
|
.ad l
|
|
.nh
|
|
.BR selinux "(8), " set_matchpathcon_flags "(3), " set_matchpathcon_invalidcon "(3), " set_matchpathcon_printf "(3), " matchpathcon_filespec_add "(3), " matchpathcon_checkmatches "(3), " freecon "(3), " setfilecon "(3), " setfscreatecon "(3)"
|