rpm 5.3.12
Defines | Functions | Variables
rpmio/rpmsx.c File Reference
#include "system.h"
#include <rpmsx.h>
#include <rpmlog.h>
#include <rpmmacro.h>
#include "debug.h"
Include dependency graph for rpmsx.c:

Go to the source code of this file.

Defines

#define _RPMSX_INTERNAL

Functions

static void rpmsxFini (void *_sx)
static rpmsx rpmsxGetPool (rpmioPool pool)
rpmsx rpmsxNew (const char *fn, unsigned int flags)
 Create and load a SELinux wrapper.
static rpmsx rpmsxI (void)
int rpmsxEnabled (rpmsx sx)
 Return SELinux enabled state.
const char * rpmsxMatch (rpmsx sx, const char *fn, mode_t mode)
 Return security context for a file.
const char * rpmsxGetfilecon (rpmsx sx, const char *fn)
 Get security context for a file.
int rpmsxSetfilecon (rpmsx sx, const char *fn, mode_t mode, const char *scon)
 Set security context for a file.
const char * rpmsxLgetfilecon (rpmsx sx, const char *fn)
int rpmsxLsetfilecon (rpmsx sx, const char *fn, mode_t mode, const char *scon)
int rpmsxExec (rpmsx sx, int verified, const char **argv)
 Execute a package scriptlet within SELinux context.

Variables

int _rpmsx_debug = 0
rpmsx _rpmsxI = NULL
rpmioPool _rpmsxPool = NULL
static const char * _rpmsxI_fn
static int _rpmsxI_flags

Detailed Description

Definition in file rpmsx.c.


Define Documentation

#define _RPMSX_INTERNAL

Definition at line 53 of file rpmsx.c.


Function Documentation

int rpmsxEnabled ( rpmsx  sx)

Return SELinux enabled state.

Parameters:
sxSELinux wrapper (NULL uses active context)
Returns:
SELinux enabled state

Definition at line 134 of file rpmsx.c.

References _rpmsx_debug.

Referenced by rpmtsCreate().

int rpmsxExec ( rpmsx  sx,
int  verified,
const char **  argv 
)

Execute a package scriptlet within SELinux context.

Parameters:
sxSELinux wrapper
verifiedScriptlet came from signature verified header? (unused)
argvscriptlet helper
Returns:
0 on success

Definition at line 275 of file rpmsx.c.

References _rpmsx_debug, environ, and rpmsxI().

Referenced by runScript().

static void rpmsxFini ( void *  _sx) [static]

Definition at line 66 of file rpmsx.c.

References _free().

Referenced by rpmsxGetPool().

const char* rpmsxGetfilecon ( rpmsx  sx,
const char *  fn 
)

Get security context for a file.

Parameters:
sxSELinux wrapper (NULL uses active context)
fnfile path
Returns:
file security context (NULL on error/disabled)

Definition at line 171 of file rpmsx.c.

References _rpmsx_debug, and rpmsxI().

static rpmsx rpmsxGetPool ( rpmioPool  pool) [static]

Definition at line 83 of file rpmsx.c.

References _rpmsx_debug, _rpmsxPool, rpmioGetPool(), rpmioNewPool(), and rpmsxFini().

Referenced by rpmsxNew().

static rpmsx rpmsxI ( void  ) [static]
const char* rpmsxLgetfilecon ( rpmsx  sx,
const char *  fn 
)

Definition at line 223 of file rpmsx.c.

References _rpmsx_debug, and rpmsxI().

int rpmsxLsetfilecon ( rpmsx  sx,
const char *  fn,
mode_t  mode,
const char *  scon 
)

Definition at line 248 of file rpmsx.c.

References _rpmsx_debug, rpmsxI(), and rpmsxMatch().

Referenced by iosmStage().

const char* rpmsxMatch ( rpmsx  sx,
const char *  fn,
mode_t  mode 
)

Return security context for a file.

Parameters:
sxSELinux wrapper (NULL uses active context)
fnfile path
modefile mode
Returns:
file security context

Definition at line 151 of file rpmsx.c.

References _rpmsx_debug, rpmsxI(), and xstrdup().

Referenced by fsmMapFContext(), fsmMkdirs(), genCpioListAndHeader(), iosmMapFContext(), iosmMkdirs(), rpmsxLsetfilecon(), and rpmsxSetfilecon().

rpmsx rpmsxNew ( const char *  fn,
unsigned int  flags 
)

Create and load a SELinux wrapper.

Parameters:
fnSELinux file (NULL uses selinux_file_context_path()).
flagsSELinux set_matchpathcon_flags() flags
Returns:
new SELinux wrapper

Definition at line 97 of file rpmsx.c.

References _free(), rpmGetPath(), rpmsxGetPool(), and rpmsxLink().

Referenced by genCpioListAndHeader(), rpmsxI(), and rpmtsSetup().

int rpmsxSetfilecon ( rpmsx  sx,
const char *  fn,
mode_t  mode,
const char *  scon 
)

Set security context for a file.

Parameters:
sxSELinux wrapper (NULL uses active context)
fnfile path
modefile mode
sconfile security context (NULL calls matchpathcon())
Returns:
0 on success

Definition at line 196 of file rpmsx.c.

References _rpmsx_debug, rpmsxI(), and rpmsxMatch().


Variable Documentation

int _rpmsx_debug = 0
rpmsx _rpmsxI = NULL

Definition at line 64 of file rpmsx.c.

Referenced by rpmioClean(), and rpmsxI().

int _rpmsxI_flags [static]

Definition at line 123 of file rpmsx.c.

Referenced by rpmsxI().

const char* _rpmsxI_fn [static]

Definition at line 121 of file rpmsx.c.

Referenced by rpmsxI().

Definition at line 81 of file rpmsx.c.

Referenced by rpmioClean(), and rpmsxGetPool().