1 /* Copyright (C) 2005 Red Hat, Inc. */ 2 3 #ifndef _SEMANAGE_USER_RECORD_H_ 4 #define _SEMANAGE_USER_RECORD_H_ 5 6 #include <stddef.h> 7 #include <semanage/handle.h> 8 9 struct semanage_user; 10 typedef struct semanage_user semanage_user_t; 11 12 #ifndef _SEMANAGE_USER_KEY_DEFINED_ 13 struct semanage_user_key; 14 typedef struct semanage_user_key semanage_user_key_t; 15 #define _SEMANAGE_USER_KEY_DEFINED_ 16 #endif 17 18 /* Key */ 19 extern int semanage_user_key_create(semanage_handle_t * handle, 20 const char *name, 21 semanage_user_key_t ** key); 22 23 extern int semanage_user_key_extract(semanage_handle_t * handle, 24 const semanage_user_t * user, 25 semanage_user_key_t ** key); 26 27 extern void semanage_user_key_free(semanage_user_key_t * key); 28 29 extern int semanage_user_compare(const semanage_user_t * user, 30 const semanage_user_key_t * key); 31 32 extern int semanage_user_compare2(const semanage_user_t * user, 33 const semanage_user_t * user2); 34 35 /* Name */ 36 extern const char *semanage_user_get_name(const semanage_user_t * user); 37 38 extern int semanage_user_set_name(semanage_handle_t * handle, 39 semanage_user_t * user, const char *name); 40 41 /* Labeling prefix */ 42 extern const char *semanage_user_get_prefix(const semanage_user_t * user); 43 44 extern int semanage_user_set_prefix(semanage_handle_t * handle, 45 semanage_user_t * user, const char *name); 46 47 /* MLS */ 48 extern const char *semanage_user_get_mlslevel(const semanage_user_t * user); 49 50 extern int semanage_user_set_mlslevel(semanage_handle_t * handle, 51 semanage_user_t * user, 52 const char *mls_level); 53 54 extern const char *semanage_user_get_mlsrange(const semanage_user_t * user); 55 56 extern int semanage_user_set_mlsrange(semanage_handle_t * handle, 57 semanage_user_t * user, 58 const char *mls_range); 59 60 /* Role management */ 61 extern int semanage_user_get_num_roles(const semanage_user_t * user); 62 63 extern int semanage_user_add_role(semanage_handle_t * handle, 64 semanage_user_t * user, const char *role); 65 66 extern void semanage_user_del_role(semanage_user_t * user, const char *role); 67 68 extern int semanage_user_has_role(const semanage_user_t * user, 69 const char *role); 70 71 extern int semanage_user_get_roles(semanage_handle_t * handle, 72 const semanage_user_t * user, 73 const char ***roles_arr, 74 unsigned int *num_roles); 75 76 extern int semanage_user_set_roles(semanage_handle_t * handle, 77 semanage_user_t * user, 78 const char **roles_arr, 79 unsigned int num_roles); 80 81 /* Create/Clone/Destroy */ 82 extern int semanage_user_create(semanage_handle_t * handle, 83 semanage_user_t ** user_ptr); 84 85 extern int semanage_user_clone(semanage_handle_t * handle, 86 const semanage_user_t * user, 87 semanage_user_t ** user_ptr); 88 89 extern void semanage_user_free(semanage_user_t * user); 90 #endif 91