1 #ifndef _SEPOL_USER_RECORD_H_ 2 #define _SEPOL_USER_RECORD_H_ 3 4 #include <stddef.h> 5 #include <sepol/handle.h> 6 7 struct sepol_user; 8 struct sepol_user_key; 9 typedef struct sepol_user sepol_user_t; 10 typedef struct sepol_user_key sepol_user_key_t; 11 12 /* Key */ 13 extern int sepol_user_key_create(sepol_handle_t * handle, 14 const char *name, sepol_user_key_t ** key); 15 16 extern void sepol_user_key_unpack(const sepol_user_key_t * key, 17 const char **name); 18 19 extern int sepol_user_key_extract(sepol_handle_t * handle, 20 const sepol_user_t * user, 21 sepol_user_key_t ** key_ptr); 22 23 extern void sepol_user_key_free(sepol_user_key_t * key); 24 25 extern int sepol_user_compare(const sepol_user_t * user, 26 const sepol_user_key_t * key); 27 28 extern int sepol_user_compare2(const sepol_user_t * user, 29 const sepol_user_t * user2); 30 31 /* Name */ 32 extern const char *sepol_user_get_name(const sepol_user_t * user); 33 34 extern int sepol_user_set_name(sepol_handle_t * handle, 35 sepol_user_t * user, const char *name); 36 37 /* MLS */ 38 extern const char *sepol_user_get_mlslevel(const sepol_user_t * user); 39 40 extern int sepol_user_set_mlslevel(sepol_handle_t * handle, 41 sepol_user_t * user, const char *mls_level); 42 43 extern const char *sepol_user_get_mlsrange(const sepol_user_t * user); 44 45 extern int sepol_user_set_mlsrange(sepol_handle_t * handle, 46 sepol_user_t * user, const char *mls_range); 47 48 /* Role management */ 49 extern int sepol_user_get_num_roles(const sepol_user_t * user); 50 51 extern int sepol_user_add_role(sepol_handle_t * handle, 52 sepol_user_t * user, const char *role); 53 54 extern void sepol_user_del_role(sepol_user_t * user, const char *role); 55 56 extern int sepol_user_has_role(const sepol_user_t * user, const char *role); 57 58 extern int sepol_user_get_roles(sepol_handle_t * handle, 59 const sepol_user_t * user, 60 const char ***roles_arr, 61 unsigned int *num_roles); 62 63 extern int sepol_user_set_roles(sepol_handle_t * handle, 64 sepol_user_t * user, 65 const char **roles_arr, unsigned int num_roles); 66 67 /* Create/Clone/Destroy */ 68 extern int sepol_user_create(sepol_handle_t * handle, sepol_user_t ** user_ptr); 69 70 extern int sepol_user_clone(sepol_handle_t * handle, 71 const sepol_user_t * user, 72 sepol_user_t ** user_ptr); 73 74 extern void sepol_user_free(sepol_user_t * user); 75 76 #endif 77