Ejemplo n.º 1
0
void oval_state_content_set_entity(struct oval_state_content *content, struct oval_entity *entity)
{
	__attribute__nonnull__(content);
	if (content->entity)
		oval_entity_free(content->entity);
	content->entity = entity;
}
Ejemplo n.º 2
0
void oval_state_content_free(struct oval_state_content *content)
{
	__attribute__nonnull__(content);

	if (content->entity)
		oval_entity_free(content->entity);
	if (content->record_fields)
		oval_collection_free_items(content->record_fields, (oscap_destruct_func) oval_record_field_free);
	oscap_free(content);
}
Ejemplo n.º 3
0
static SEXP_t *oval_record_field_STATE_to_sexp(struct oval_record_field *rf)
{
	struct oval_entity *rf_ent;
	struct oval_variable *var;
	oval_check_t ochk;
	oval_datatype_t dt;
	SEXP_t *rf_sexp, *r0;

	rf_ent = oval_entity_new(NULL);
	oval_entity_set_name(rf_ent, oval_record_field_get_name(rf));
	oval_entity_set_operation(rf_ent, oval_record_field_get_operation(rf));
	dt = oval_record_field_get_datatype(rf);
	oval_entity_set_datatype(rf_ent, dt);

	var = oval_record_field_get_variable(rf);
	if (var != NULL) {
		oval_entity_set_varref_type(rf_ent, OVAL_ENTITY_VARREF_ATTRIBUTE);
		oval_entity_set_variable(rf_ent, var);
	} else {
		struct oval_value *val;

		val = oval_value_new(dt, oval_record_field_get_value(rf));
		oval_entity_set_value(rf_ent, val);
	}

	rf_sexp = oval_entity_to_sexp(rf_ent);

	ochk = oval_record_field_get_var_check(rf);
	if (ochk != OVAL_CHECK_UNKNOWN) {
		probe_ent_attr_add(rf_sexp, "var_check", r0 = SEXP_number_newu_32(ochk));
		SEXP_free(r0);
	}
	ochk = oval_record_field_get_ent_check(rf);
	if (ochk != OVAL_CHECK_UNKNOWN) {
		probe_ent_attr_add(rf_sexp, "entity_check", r0 = SEXP_number_newu_32(ochk));
		SEXP_free(r0);
	}

	oval_entity_free(rf_ent);
	return rf_sexp;
}