| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifdef HAVE_CONFIG_H |
| 24 |
#include <config.h> |
| 25 |
#endif |
| 26 |
|
| 27 |
#include <stdio.h> |
| 28 |
|
| 29 |
#include <ds_rds_session.h> |
| 30 |
#include <oscap_source.h> |
| 31 |
#include <xccdf_benchmark.h> |
| 32 |
#include <xccdf_policy.h> |
| 33 |
|
| 34 |
#include "oscap_assert.h" |
| 35 |
#include "unit_helper.h" |
| 36 |
|
| 37 |
int main(int argc, char *argv[]) |
| 38 |
{ |
| 39 |
oscap_assert(argc == 2); |
| 40 |
struct oscap_source *rds_source = oscap_source_new_from_file(argv[1]); |
| 41 |
struct ds_rds_session *rds = ds_rds_session_new_from_source(rds_source); |
| 42 |
oscap_assert(rds != NULL); |
| 43 |
struct oscap_source *tr_source = ds_rds_session_select_report(rds, NULL); |
| 44 |
oscap_assert(tr_source != NULL); |
| 45 |
struct xccdf_result *tr = xccdf_result_import_source(tr_source); |
| 46 |
oscap_assert(tr != NULL); |
| 47 |
struct xccdf_rule_result *rr = xccdf_result_get_rule_result_by_id(tr, "x"); |
| 48 |
oscap_assert(rr == NULL); |
| 49 |
rr = xccdf_result_get_rule_result_by_id(tr, "xccdf_org.ssgproject.content_rule_disable_prelink"); |
| 50 |
oscap_assert(rr != NULL); |
| 51 |
struct oscap_text* waiver = oscap_text_new(); |
| 52 |
oscap_text_set_text(waiver, "I believe this should have passed"); |
| 53 |
oscap_assert(xccdf_rule_result_override(rr, XCCDF_RESULT_PASS, "yesterday", "intern contractor", waiver)); |
| 54 |
tr_source = xccdf_result_export_source(tr, NULL); |
| 55 |
oscap_assert(tr_source != NULL); |
| 56 |
|
| 57 |
|
| 58 |
oscap_assert(ds_rds_session_replace_report_with_source(rds, tr_source) == 0); |
| 59 |
|
| 60 |
oscap_assert(oscap_source_save_as(rds_source, "test_xccdf_overrides.xml.out") == 0); |
| 61 |
|
| 62 |
xccdf_result_free(tr); |
| 63 |
ds_rds_session_free(rds); |
| 64 |
oscap_source_free(rds_source); |
| 65 |
return 0; |
| 66 |
} |
| 67 |
|