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 /* These two functions are deprecated. See src/deprecated_funcs.c */ 14 extern int sepol_genusers(void *data, size_t len, 15 const char *usersdir, 16 void **newdata, size_t * newlen); 17 extern void sepol_set_delusers(int on); 18 19 /* Modify the user, or add it, if the key is not found */ 20 extern int sepol_user_modify(sepol_handle_t * handle, 21 sepol_policydb_t * policydb, 22 const sepol_user_key_t * key, 23 const sepol_user_t * data); 24 25 /* Return the number of users */ 26 extern int sepol_user_count(sepol_handle_t * handle, 27 const sepol_policydb_t * p, unsigned int *response); 28 29 /* Check if the specified user exists */ 30 extern int sepol_user_exists(sepol_handle_t * handle, 31 const sepol_policydb_t * policydb, 32 const sepol_user_key_t * key, int *response); 33 34 /* Query a user - returns the user or NULL if not found */ 35 extern int sepol_user_query(sepol_handle_t * handle, 36 const sepol_policydb_t * p, 37 const sepol_user_key_t * key, 38 sepol_user_t ** response); 39 40 /* Iterate the users 41 * The handler may return: 42 * -1 to signal an error condition, 43 * 1 to signal successful exit 44 * 0 to signal continue */ 45 extern int sepol_user_iterate(sepol_handle_t * handle, 46 const sepol_policydb_t * policydb, 47 int (*fn) (const sepol_user_t * user, 48 void *fn_arg), void *arg); 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif 55