| 1 |
#ifndef _SEPOL_USERS_H_ |
| 2 |
#define _SEPOL_USERS_H_ |
| 3 |
|
| 4 |
#include <sepol/policydb.h> |
| 5 |
#include <sepol/user_record.h> |
| 6 |
#include <sepol/handle.h> |
| 7 |
#include <stddef.h> |
| 8 |
|
| 9 |
#ifdef __cplusplus |
| 10 |
extern "C" { |
| 11 |
#endif |
| 12 |
|
| 13 |
/* Modify the user, or add it, if the key is not found */ |
| 14 |
extern int sepol_user_modify(sepol_handle_t * handle, |
| 15 |
sepol_policydb_t * policydb, |
| 16 |
const sepol_user_key_t * key, |
| 17 |
const sepol_user_t * data); |
| 18 |
|
| 19 |
/* Return the number of users */ |
| 20 |
extern int sepol_user_count(sepol_handle_t * handle, |
| 21 |
const sepol_policydb_t * p, unsigned int *response); |
| 22 |
|
| 23 |
/* Check if the specified user exists */ |
| 24 |
extern int sepol_user_exists(sepol_handle_t * handle, |
| 25 |
const sepol_policydb_t * policydb, |
| 26 |
const sepol_user_key_t * key, int *response); |
| 27 |
|
| 28 |
/* Query a user - returns the user or NULL if not found */ |
| 29 |
extern int sepol_user_query(sepol_handle_t * handle, |
| 30 |
const sepol_policydb_t * p, |
| 31 |
const sepol_user_key_t * key, |
| 32 |
sepol_user_t ** response); |
| 33 |
|
| 34 |
/* Iterate the users |
| 35 |
* The handler may return: |
| 36 |
* -1 to signal an error condition, |
| 37 |
* 1 to signal successful exit |
| 38 |
* 0 to signal continue */ |
| 39 |
extern int sepol_user_iterate(sepol_handle_t * handle, |
| 40 |
const sepol_policydb_t * policydb, |
| 41 |
int (*fn) (const sepol_user_t * user, |
| 42 |
void *fn_arg), void *arg); |
| 43 |
|
| 44 |
#ifdef __cplusplus |
| 45 |
} |
| 46 |
#endif |
| 47 |
|
| 48 |
#endif |