rpm
5.2.1
|
#include "system.h"
#include <rpmiotypes.h>
#include <rpmio.h>
#include <rpmmacro.h>
#include <yarn.h>
#include <rpmtypes.h>
#include "rpmsx.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | _RPMSX_INTERNAL |
#define | inc_err() nerr++ |
Functions | |
static void | rpmsxSort (rpmsx sx) |
Stable sort for policy specifications, patterns before paths. | |
static void | rpmsxpHasMetaChars (rpmsxp sxp) |
static size_t | rpmsxsPStem (const char *const buf) |
Return the length of the text that can be considered the stem. | |
static size_t | rpmsxsFStem (const char *const buf) |
Return the length of the text that is the stem of a file name. | |
static int | rpmsxAdd (rpmsx sx, const char **bpp) |
Find (or create) the stem of a file spec. | |
static int | rpmsxFind (const rpmsx sx, const char **bpp) |
Find the stem of a file name. | |
static void | rpmsxFini (void *_sx) |
static rpmsx | rpmsxGetPool (rpmioPool pool) |
static int | rpmsxpCheckNoDupes (const rpmsx sx) |
Check for duplicate specifications. | |
int | rpmsxParse (rpmsx sx, const char *fn) |
Parse selinux file security context patterns. | |
rpmsx | rpmsxNew (const char *fn) |
Create and load security context patterns. | |
int | rpmsxCount (const rpmsx sx) |
Return security context patterns count. | |
int | rpmsxIx (const rpmsx sx) |
Return security context patterns index. | |
int | rpmsxSetIx (rpmsx sx, int ix) |
Set security context patterns index. | |
const char * | rpmsxPattern (const rpmsx sx) |
Return current pattern. | |
const char * | rpmsxType (const rpmsx sx) |
Return current type. | |
const char * | rpmsxContext (const rpmsx sx) |
Return current context. | |
regex_t * | rpmsxRE (const rpmsx sx) |
Return current regex. | |
mode_t | rpmsxFMode (const rpmsx sx) |
Return current file mode. | |
int | rpmsxFStem (const rpmsx sx) |
Return current file stem. | |
int | rpmsxNext (rpmsx sx) |
Return next security context patterns iterator index. | |
rpmsx | rpmsxInit (rpmsx sx, int reverse) |
Initialize security context patterns iterator. | |
const char * | rpmsxFContext (rpmsx sx, const char *fn, mode_t fmode) |
Find file security context from path and type. | |
Variables | |
int | _rpmsx_debug = 0 |
rpmioPool | _rpmsxPool |
#define inc_err | ( | ) | nerr++ |
Referenced by rpmsxParse().
|
static |
Find (or create) the stem of a file spec.
Error iff a file in the root directory or a regex that is too complex.
*bpp | ptr to text after stem. |
Definition at line 142 of file rpmsx.c.
References rpmsxsPStem(), xmalloc(), and xrealloc().
Referenced by rpmsxParse().
const char* rpmsxContext | ( | const rpmsx | sx | ) |
Return current context.
sx | security context patterns |
Definition at line 559 of file rpmsx.c.
Referenced by rpmsxFContext().
int rpmsxCount | ( | const rpmsx | sx | ) |
const char* rpmsxFContext | ( | rpmsx | sx, |
const char * | fn, | ||
mode_t | fmode | ||
) |
Find file security context from path and type.
sx | security context patterns |
fn | file path |
fmode | file mode |
Definition at line 639 of file rpmsx.c.
References rpmsxContext(), rpmsxFind(), rpmsxFMode(), rpmsxFStem(), rpmsxInit(), rpmsxNext(), rpmsxPattern(), and rpmsxRE().
|
static |
Find the stem of a file name.
Error iff a file in the root directory or a regex that is too complex.
sx | security context patterns |
*bpp | ptr to text after stem. |
Definition at line 186 of file rpmsx.c.
References rpmsxsFStem().
Referenced by rpmsxFContext().
|
static |
mode_t rpmsxFMode | ( | const rpmsx | sx | ) |
Return current file mode.
sx | security context patterns |
Definition at line 577 of file rpmsx.c.
Referenced by rpmsxFContext().
int rpmsxFStem | ( | const rpmsx | sx | ) |
Return current file stem.
sx | security context patterns |
Definition at line 586 of file rpmsx.c.
Referenced by rpmsxFContext().
Definition at line 236 of file rpmsx.c.
References _rpmsx_debug, _rpmsxPool, rpmioGetPool(), rpmioNewPool(), and rpmsxFini().
Referenced by rpmsxNew().
Initialize security context patterns iterator.
sx | security context patterns |
reverse | iterate in reverse order? |
Definition at line 627 of file rpmsx.c.
References reverse.
Referenced by rpmsxFContext().
int rpmsxIx | ( | const rpmsx | sx | ) |
rpmsx rpmsxNew | ( | const char * | fn | ) |
Create and load security context patterns.
fn | security context patterns file name |
Definition at line 500 of file rpmsx.c.
References rpmsxFree(), rpmsxGetPool(), rpmsxLink(), and rpmsxParse().
int rpmsxNext | ( | rpmsx | sx | ) |
Return next security context patterns iterator index.
sx | security context patterns |
Definition at line 595 of file rpmsx.c.
References _rpmsx_debug.
Referenced by rpmsxFContext().
int rpmsxParse | ( | rpmsx | sx, |
const char * | fn | ||
) |
Parse selinux file security context patterns.
sx | security context patterns |
fn | file name to parse |
Definition at line 298 of file rpmsx.c.
References _, _free(), errno, inc_err, items, rpmGetPath(), rpmsxAdd(), rpmsxpCheckNoDupes(), rpmsxpHasMetaChars(), rpmsxSort(), S_IFSOCK, security_check_context, xcalloc(), and xmalloc().
Referenced by rpmsxNew().
const char* rpmsxPattern | ( | const rpmsx | sx | ) |
Return current pattern.
sx | security context patterns |
Definition at line 541 of file rpmsx.c.
Referenced by rpmsxFContext().
|
static |
Check for duplicate specifications.
If a duplicate specification is found and the context is the same, give a warning to the user. If a duplicate specification is found and the context is different, give a warning to the user (This could be changed to error). Return of non-zero is an error.
sx | security context patterns |
Definition at line 259 of file rpmsx.c.
Referenced by rpmsxParse().
|
static |
Definition at line 61 of file rpmsx.c.
Referenced by rpmsxParse().
regex_t* rpmsxRE | ( | const rpmsx | sx | ) |
Return current regex.
sx | security context patterns |
Definition at line 568 of file rpmsx.c.
Referenced by rpmsxFContext().
int rpmsxSetIx | ( | rpmsx | sx, |
int | ix | ||
) |
|
static |
Return the length of the text that is the stem of a file name.
Definition at line 125 of file rpmsx.c.
Referenced by rpmsxFind().
|
static |
Stable sort for policy specifications, patterns before paths.
sx | security context patterns |
Definition at line 27 of file rpmsx.c.
References _free(), and xmalloc().
Referenced by rpmsxParse().
|
static |
Return the length of the text that can be considered the stem.
Definition at line 103 of file rpmsx.c.
Referenced by rpmsxAdd().
const char* rpmsxType | ( | const rpmsx | sx | ) |
int _rpmsx_debug = 0 |
Definition at line 21 of file rpmsx.c.
Referenced by rpmsxGetPool(), and rpmsxNext().
rpmioPool _rpmsxPool |
Definition at line 234 of file rpmsx.c.
Referenced by rpmsxGetPool().