rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Typedefs | Functions | Variables
lib/rpmsx.h File Reference

Structure(s) used for file security context pattern handling. More...

`#include <regex.h>`
Include dependency graph for rpmsx.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines

#define | rpmsxUnlink(_sx, _msg) ((rpmsx)rpmioUnlinkPoolItem((rpmioItem)(_sx), _msg, __FILE__, __LINE__))
#define | rpmsxLink(_sx, _msg) ((rpmsx)rpmioLinkPoolItem((rpmioItem)(_sx), _msg, __FILE__, __LINE__))
#define | rpmsxFree(_sx) ((rpmsx)rpmioFreePoolItem((rpmioItem)(_sx), __FUNCTION__, __FILE__, __LINE__))

## Typedefs

typedef struct rpmsx_s * | rpmsx
typedef struct rpmsxp_s * | rpmsxp
typedef struct rpmsxs_s * | rpmsxs

## Functions

rpmsx | rpmsxUnlink (rpmsx sx, const char *msg)
| Unreference a security context patterns instance.
rpmsx | rpmsxLink (rpmsx sx, const char *msg)
| Reference a security context patterns instance.
rpmsx | rpmsxFree (rpmsx sx)
| Destroy a security context patterns.
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
int | _rpmsx_nopromote

## Detailed Description

Structure(s) used for file security context pattern handling.

Definition in file rpmsx.h.

## Define Documentation

#define rpmsxFree | ( |  | _sx | ) | ((rpmsx)rpmioFreePoolItem((rpmioItem)(_sx), __FUNCTION__, __FILE__, __LINE__))

Definition at line 119 of file rpmsx.h.

#define rpmsxLink | ( |  | _sx,
|  |  | _msg
| ) |  | ((rpmsx)rpmioLinkPoolItem((rpmioItem)(_sx), _msg, __FILE__, __LINE__))

Definition at line 108 of file rpmsx.h.

#define rpmsxUnlink | ( |  | _sx,
|  |  | _msg
| ) |  | ((rpmsx)rpmioUnlinkPoolItem((rpmioItem)(_sx), _msg, __FILE__, __LINE__))

Definition at line 96 of file rpmsx.h.

## Typedef Documentation

typedef struct rpmsx_s* rpmsx

Definition at line 29 of file rpmsx.h.

typedef struct rpmsxp_s* rpmsxp

Definition at line 30 of file rpmsx.h.

typedef struct rpmsxs_s* rpmsxs

Definition at line 31 of file rpmsx.h.

## Function Documentation

const char* rpmsxContext | ( | const rpmsx | sx | ) |

Return current context.

Parameters:

  sx | security context patterns

Returns:
  current context, NULL on invalid

Definition at line 559 of file rpmsx.c.

Referenced by rpmsxFContext().

int rpmsxCount | ( | const rpmsx | sx | ) |

Return security context patterns count.

Parameters:

  sx | security context patterns

Returns:
  current count

Definition at line 520 of file rpmsx.c.

const char* rpmsxFContext | ( | rpmsx | sx,
|  | const char * | fn,
|  | mode_t | fmode
| ) |  |

Find file security context from path and type.

Parameters:

  sx | security context patterns
  fn | file path
  fmode | file mode

Returns:
  file security context

Definition at line 639 of file rpmsx.c.

References rpmsxContext(), rpmsxFind(), rpmsxFMode(), rpmsxFStem(), rpmsxInit(), rpmsxNext(), rpmsxPattern(), and rpmsxRE().

mode_t rpmsxFMode | ( | const rpmsx | sx | ) |

Return current file mode.

Parameters:

  sx | security context patterns

Returns:
  current file mode, 0 on invalid

Definition at line 577 of file rpmsx.c.

Referenced by rpmsxFContext().

rpmsx rpmsxFree | ( | rpmsx | sx | ) |

Destroy a security context patterns.

Parameters:

  sx | security context patterns

Returns:
  NULL on last dereference

Referenced by rpmsxNew(), and rpmtsFini().

int rpmsxFStem | ( | const rpmsx | sx | ) |

Return current file stem.

Parameters:

  sx | security context patterns

Returns:
  current file stem, -1 on invalid

Definition at line 586 of file rpmsx.c.

Referenced by rpmsxFContext().

rpmsx rpmsxInit | ( | rpmsx | sx,
|  | int | reverse
| ) |  |

Initialize security context patterns iterator.

Parameters:

  sx | security context patterns
  reverse | iterate in reverse order?

Returns:
  security context patterns

Definition at line 627 of file rpmsx.c.

References reverse.

Referenced by rpmsxFContext().

int rpmsxIx | ( | const rpmsx | sx | ) |

Return security context patterns index.

Parameters:

  sx | security context patterns

Returns:
  current index

Definition at line 525 of file rpmsx.c.

rpmsx rpmsxLink | ( | rpmsx | sx,
|  | const char * | msg
| ) |  |

Reference a security context patterns instance.

Parameters:

  sx | security context patterns
  msg |

Returns:
  new security context patterns reference

Referenced by rpmsxNew().

rpmsx rpmsxNew | ( | const char * | fn | ) |

Create and load security context patterns.

Parameters:

  fn | security context patterns file name

Returns:
  new security context patterns

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.

Parameters:

  sx | security context patterns

Returns:
  security context patterns iterator index, -1 on termination

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.

Parameters:

  sx | security context patterns
  fn | file name to parse

Returns:
  0 on success

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.

Parameters:

  sx | security context patterns

Returns:
  current pattern, NULL on invalid

Definition at line 541 of file rpmsx.c.

Referenced by rpmsxFContext().

regex_t* rpmsxRE | ( | const rpmsx | sx | ) |

Return current regex.

Parameters:

  sx | security context patterns

Returns:
  current context, NULL on invalid

Definition at line 568 of file rpmsx.c.

Referenced by rpmsxFContext().

int rpmsxSetIx | ( | rpmsx | sx,
|  | int | ix
| ) |  |

Set security context patterns index.

Parameters:

  sx | security context patterns
  ix | new index

Returns:
  current index

Definition at line 530 of file rpmsx.c.

const char* rpmsxType | ( | const rpmsx | sx | ) |

Return current type.

Parameters:

  sx | security context patterns

Returns:
  current type, NULL on invalid/missing

Definition at line 550 of file rpmsx.c.

rpmsx rpmsxUnlink | ( | rpmsx | sx,
|  | const char * | msg
| ) |  |

Unreference a security context patterns instance.

Parameters:

  sx | security context patterns
  msg |

Returns:
  NULL on last dereference

## Variable Documentation

int _rpmsx_debug

Definition at line 21 of file rpmsx.c.

int _rpmsx_nopromote