libsemanage: Add support for listing fcontext.homedirs file
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1409813 Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
This commit is contained in:
parent
5007687feb
commit
bc161a9e94
4 changed files with 32 additions and 6 deletions
|
@ -26,4 +26,8 @@ extern int semanage_fcontext_list(semanage_handle_t * handle,
|
|||
semanage_fcontext_t *** records,
|
||||
unsigned int *count);
|
||||
|
||||
extern int semanage_fcontext_list_homedirs(semanage_handle_t * handle,
|
||||
semanage_fcontext_t *** records,
|
||||
unsigned int *count);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -210,6 +210,12 @@ int semanage_direct_connect(semanage_handle_t * sh)
|
|||
semanage_fcontext_dbase_local(sh)) < 0)
|
||||
goto err;
|
||||
|
||||
if (fcontext_file_dbase_init(sh,
|
||||
semanage_path(SEMANAGE_ACTIVE, SEMANAGE_STORE_FC_HOMEDIRS),
|
||||
semanage_path(SEMANAGE_TMP, SEMANAGE_STORE_FC_HOMEDIRS),
|
||||
semanage_fcontext_dbase_homedirs(sh)) < 0)
|
||||
goto err;
|
||||
|
||||
if (seuser_file_dbase_init(sh,
|
||||
semanage_path(SEMANAGE_ACTIVE,
|
||||
SEMANAGE_SEUSERS_LOCAL),
|
||||
|
@ -349,6 +355,7 @@ static int semanage_direct_disconnect(semanage_handle_t * sh)
|
|||
iface_file_dbase_release(semanage_iface_dbase_local(sh));
|
||||
bool_file_dbase_release(semanage_bool_dbase_local(sh));
|
||||
fcontext_file_dbase_release(semanage_fcontext_dbase_local(sh));
|
||||
fcontext_file_dbase_release(semanage_fcontext_dbase_homedirs(sh));
|
||||
seuser_file_dbase_release(semanage_seuser_dbase_local(sh));
|
||||
node_file_dbase_release(semanage_node_dbase_local(sh));
|
||||
|
||||
|
|
|
@ -51,3 +51,11 @@ int semanage_fcontext_list(semanage_handle_t * handle,
|
|||
dbase_config_t *dconfig = semanage_fcontext_dbase_policy(handle);
|
||||
return dbase_list(handle, dconfig, records, count);
|
||||
}
|
||||
|
||||
int semanage_fcontext_list_homedirs(semanage_handle_t * handle,
|
||||
semanage_fcontext_t *** records, unsigned int *count)
|
||||
{
|
||||
|
||||
dbase_config_t *dconfig = semanage_fcontext_dbase_homedirs(handle);
|
||||
return dbase_list(handle, dconfig, records, count);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ struct semanage_handle {
|
|||
struct semanage_policy_table *funcs;
|
||||
|
||||
/* Object databases */
|
||||
#define DBASE_COUNT 23
|
||||
#define DBASE_COUNT 24
|
||||
|
||||
/* Local modifications */
|
||||
#define DBASE_LOCAL_USERS_BASE 0
|
||||
|
@ -102,13 +102,14 @@ struct semanage_handle {
|
|||
#define DBASE_POLICY_INTERFACES 15
|
||||
#define DBASE_POLICY_BOOLEANS 16
|
||||
#define DBASE_POLICY_FCONTEXTS 17
|
||||
#define DBASE_POLICY_SEUSERS 18
|
||||
#define DBASE_POLICY_NODES 19
|
||||
#define DBASE_POLICY_IBPKEYS 20
|
||||
#define DBASE_POLICY_IBENDPORTS 21
|
||||
#define DBASE_POLICY_FCONTEXTS_H 18
|
||||
#define DBASE_POLICY_SEUSERS 19
|
||||
#define DBASE_POLICY_NODES 20
|
||||
#define DBASE_POLICY_IBPKEYS 21
|
||||
#define DBASE_POLICY_IBENDPORTS 22
|
||||
|
||||
/* Active kernel policy */
|
||||
#define DBASE_ACTIVE_BOOLEANS 22
|
||||
#define DBASE_ACTIVE_BOOLEANS 23
|
||||
dbase_config_t dbase[DBASE_COUNT];
|
||||
};
|
||||
|
||||
|
@ -235,6 +236,12 @@ static inline
|
|||
return &handle->dbase[DBASE_POLICY_FCONTEXTS];
|
||||
}
|
||||
|
||||
static inline
|
||||
dbase_config_t * semanage_fcontext_dbase_homedirs(semanage_handle_t * handle)
|
||||
{
|
||||
return &handle->dbase[DBASE_POLICY_FCONTEXTS_H];
|
||||
}
|
||||
|
||||
static inline
|
||||
dbase_config_t * semanage_seuser_dbase_policy(semanage_handle_t * handle)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue