Esempio n. 1
0
static int bool_update(sepol_handle_t * handle,
		       policydb_t * policydb,
		       const sepol_bool_key_t * key, const sepol_bool_t * data)
{

	const char *cname;
	char *name;
	int value;

	sepol_bool_key_unpack(key, &cname);
	name = strdup(cname);
	value = sepol_bool_get_value(data);

	if (!name)
		goto omem;

	cond_bool_datum_t *datum =
	    hashtab_search(policydb->p_bools.table, name);
	if (!datum) {
		LOGD("boolean %s no longer in policy", name);
		goto err;
	}
	if (value != 0 && value != 1) {
		LOGD("illegal value %d for boolean %s", value, name);
		goto err;
	}

	free(name);
	datum->state = value;
	return STATUS_SUCCESS;

      omem:
	LOGD("out of memory");

      err:
	free(name);
	LOGD("could not update boolean %s", cname);
	return STATUS_ERR;
}
Esempio n. 2
0
/* Value */
int semanage_bool_get_value(const semanage_bool_t * boolean)
{

	return sepol_bool_get_value(boolean);
}