Skip to content

Commit

Permalink
Implement xccdf_session_get_rule_results function in session API
Browse files Browse the repository at this point in the history
This change adds a new public xccdf_session_get_rule_results function
to the session API.

This function returns rule results.

Results could be iterated using the xccdf_rule_result_iterator_has_more
function from the XCCDF benchmark API.
  • Loading branch information
0intro committed Sep 4, 2023
1 parent ed91feb commit a23f45a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/XCCDF/public/xccdf_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,17 @@ OSCAP_API unsigned int xccdf_session_get_cpe_oval_agents_count(const struct xccd
*/
OSCAP_API bool xccdf_session_contains_fail_result(const struct xccdf_session *session);

/**
* @struct xccdf_rule_result_iterator
*/
struct xccdf_rule_result_iterator;

/**
* Get rule results.
* @memberof xccdf_session
* @param session XCCDF Session
OSCAP_API struct xccdf_rule_result_iterator *xccdf_session_get_rule_results(const struct xccdf_session *session);
/**
* Run XCCDF Remediation. It uses XCCDF Policy and XCCDF TestResult from the session
* and modifies the TestResult. This also drops and recreate OVAL Agent Session, thus
Expand Down
5 changes: 5 additions & 0 deletions src/XCCDF/xccdf_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,11 @@ bool xccdf_session_contains_fail_result(const struct xccdf_session *session)
return false;
}

struct xccdf_rule_result_iterator *xccdf_session_get_rule_results(const struct xccdf_session *session)
{
return xccdf_result_get_rule_results(session->xccdf.result);
}

int xccdf_session_remediate(struct xccdf_session *session)
{
int res = 0;
Expand Down

0 comments on commit a23f45a

Please sign in to comment.