libsemanage: do boolean name substitution

So people can use -P and it will work.

Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
Eric Paris 2012-09-12 13:17:30 -04:00
parent ee6901618c
commit b0b22829eb

View File

@ -19,6 +19,8 @@ typedef semanage_bool_key_t record_key_t;
#include "boolean_internal.h"
#include "handle.h"
#include "database.h"
#include <stdlib.h>
#include <selinux/selinux.h>
/* Key */
int semanage_bool_key_create(semanage_handle_t * handle,
@ -82,8 +84,11 @@ hidden_def(semanage_bool_get_name)
int semanage_bool_set_name(semanage_handle_t * handle,
semanage_bool_t * boolean, const char *name)
{
return sepol_bool_set_name(handle->sepolh, boolean, name);
int rc;
char *subname = selinux_boolean_sub(name);
rc = sepol_bool_set_name(handle->sepolh, boolean, subname);
free(subname);
return rc;
}
hidden_def(semanage_bool_set_name)