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