matchpathcon - Online Linux Manual PageSection : 3
Updated : 21 November 2009
Source : sds@tycho.nsa.gov
Note : SELinux API documentation
NAMEmatchpathcon, matchpathcon_index − get the default SELinux security context for the specified path from the file contexts configuration
SYNOPSIS#include <selinux/selinux.h> int matchpathcon_init(const char *path); int matchpathcon_init_prefix(const char *path, const char *prefix); int matchpathcon_fini(void); int matchpathcon(const char *path, mode_t mode, char **con"); int matchpathcon_index(const char *name, mode_t mode, char **con);
DESCRIPTIONThis family of functions is deprecated. For new code, please use selabel_open(3) with the SELABEL_CTX_FILE backend in place of matchpathcon_init(), use selabel_close(3) in place of matchpathcon_fini(), and use selabel_lookup(3) in place of matchpathcon(). The remaining description below is for the legacy interface. matchpathcon_init() loads the file contexts configuration specified by path into memory for use by subsequent matchpathcon() calls. If path is NULL, then the active file contexts configuration is loaded by default, i.e. the path returned by selinux_file_context_path(3). Unless the MATCHPATHCON_BASEONLY flag has been set via set_matchpathcon_flags(3), files with the same path prefix but a .homedirs and .local suffix are also looked up and loaded if present. These files provide dynamically generated entries for user home directories and for local customizations. matchpathcon_init_prefix() is the same as matchpathcon_init() but only loads entries with regular expressions whose first pathname component is a prefix of prefix , e.g. pass "/dev" if you only intend to call matchpathcon() with pathnames beginning with /dev. However, this optimization is no longer necessary due to the use of file_contexts.bin files with precompiled regular expressions, so use of this interface is deprecated. matchpathcon_fini() frees the memory allocated by a prior call to matchpathcon_init.() This function can be used to free and reset the internal state between multiple matchpathcon_init() calls, or to free memory when finished using matchpathcon(). matchpathcon() matches the specified pathname, after transformation via realpath(3) excepting any final symbolic link component if S_IFLNK was specified as the mode, and mode against the file contexts configuration and sets the security context con to refer to the resulting context. The caller must free the returned security context con using freecon(3) when finished using it. 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 mode are used. If matchpathcon_init() has not already been called, then this function will call it upon its first invocation with a NULL path, defaulting to the active file contexts configuration. matchpathcon_index() is the same as matchpathcon() but returns a specification index that can later be used in a matchpathcon_filespec_add(3) call.
RETURN VALUEReturns zero on success or −1 otherwise.
SEE ALSOselinux(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)" 0
Johanes Gumabo
Data Size : 10,299 byte
man-matchpathcon_fini.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 199,880
Visitor ID : :
Visitor IP : 3.12.163.23 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.