| 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 <xccdf_benchmark.h> |
| 30 |
#include <xccdf_policy.h> |
| 31 |
|
| 32 |
#include "oscap_assert.h" |
| 33 |
#include "unit_helper.h" |
| 34 |
|
| 35 |
int main(int argc, char *argv[]) |
| 36 |
{ |
| 37 |
oscap_assert(argc == 2); |
| 38 |
struct xccdf_policy_model* policy_model = uh_load_xccdf(argv[1]); |
| 39 |
struct xccdf_policy *policy = uh_get_default_policy(policy_model); |
| 40 |
uh_register_simple_engines(policy_model); |
| 41 |
|
| 42 |
struct xccdf_result *ritem = xccdf_policy_evaluate(policy); |
| 43 |
oscap_assert(ritem != NULL); |
| 44 |
|
| 45 |
struct xccdf_model_iterator *model_it = xccdf_benchmark_get_models( |
| 46 |
xccdf_policy_model_get_benchmark(policy_model)); |
| 47 |
while (xccdf_model_iterator_has_more(model_it)) { |
| 48 |
struct xccdf_model *model = xccdf_model_iterator_next(model_it); |
| 49 |
struct xccdf_score *score = xccdf_policy_get_score(policy, ritem, xccdf_model_get_system(model)); |
| 50 |
printf("Score was %f\n", (float) xccdf_score_get_score(score)); |
| 51 |
oscap_assert((int)xccdf_score_get_score(score) == 100); |
| 52 |
} |
| 53 |
xccdf_policy_model_free(policy_model); |
| 54 |
return 0; |
| 55 |
} |
| 56 |
|