struct oval_value *oval_value_clone(struct oval_value *old_value) { __attribute__nonnull__(old_value); struct oval_value *new_value = oval_value_new(old_value->datatype, old_value->text); return new_value; }
static void oval_consume_varref(char *varref, void *user) { __attribute__nonnull__(user); struct oval_consume_varref_context *ctx = user; *(ctx->variable) = oval_definition_model_get_new_variable((struct oval_definition_model *)ctx->model, varref, OVAL_VARIABLE_UNKNOWN); *(ctx->value) = oval_value_new(OVAL_DATATYPE_STRING, varref); }
int oval_value_parse_tag(xmlTextReaderPtr reader, struct oval_parser_context *context, oval_value_consumer consumer, void *user) { int return_code; oval_datatype_t datatype = oval_datatype_parse(reader, "datatype", OVAL_DATATYPE_STRING); char *text = NULL; int isNil = oval_parser_boolean_attribute(reader, "xsi:nil", 0); if (isNil) { return_code = 0; } else { return_code = oscap_parser_text_value(reader, &oval_value_parse_tag_consume_text, &text); } struct oval_value *value = oval_value_new(datatype, text ? text : ""); oscap_free(text); (*consumer) (value, user); return return_code; }
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; }