Skip to content

Commit

Permalink
Merge pull request #2181 from jan-cerny/oscap_info_reduction
Browse files Browse the repository at this point in the history
Reduce oscap info output
  • Loading branch information
matusmarhefka authored Dec 3, 2024
2 parents e4ddfc8 + 9917e9a commit b88b330
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
9 changes: 0 additions & 9 deletions docs/manual/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,6 @@ Checklists:
system: http://scap.nist.gov/schema/ocil/2
security-data-oval-com.redhat.rhsa-RHEL8.xml
system: http://oval.mitre.org/XMLSchema/oval-definitions-5
Checks:
Ref-Id: scap_org.open-scap_cref_ssg-rhel8-oval.xml
Ref-Id: scap_org.open-scap_cref_ssg-rhel8-ocil.xml
Ref-Id: scap_org.open-scap_cref_ssg-rhel8-cpe-oval.xml
Ref-Id: scap_org.open-scap_cref_security-data-oval-com.redhat.rhsa-RHEL8.xml
Dictionaries:
Ref-Id: scap_org.open-scap_cref_ssg-rhel8-cpe-dictionary.xml
----

* **Document type** describes what format the file is in. Common types include
Expand All @@ -225,8 +218,6 @@ shown for XCCDF files and Checklists and is sourced from the XCCDF **Status**
element.
* **Profiles** lists available profiles, their titles and IDs that you can use for
the `--profile` command line attribute.
* **Checks** and **Dictionaries** lists OVAL checks components and CPE
dictionaries components in the given data stream.

To display more detailed information about a profile including the profile
description, use the `--profile` option followed by the profile ID.
Expand Down
27 changes: 5 additions & 22 deletions utils/oscap-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,11 @@ static inline void _print_xccdf_referenced_files(struct xccdf_policy_model *poli
printf("%sReferenced check files:\n", prefix);
while (oscap_file_entry_iterator_has_more(files_it)) {
struct oscap_file_entry *file_entry = (struct oscap_file_entry *) oscap_file_entry_iterator_next(files_it);
printf("%s\t%s\n", prefix, oscap_file_entry_get_file(file_entry));
printf("%s\t\tsystem: %s\n", prefix, oscap_file_entry_get_system(file_entry));
const char *system = oscap_file_entry_get_system(file_entry);
if (strcmp(system, "http://open-scap.org/page/SCE")) {
printf("%s\t%s\n", prefix, oscap_file_entry_get_file(file_entry));
printf("%s\t\tsystem: %s\n", prefix, oscap_file_entry_get_system(file_entry));
}
}
oscap_file_entry_iterator_free(files_it);
oscap_file_entry_list_free(referenced_files);
Expand Down Expand Up @@ -490,26 +493,6 @@ static int app_info_single_ds_all(struct ds_stream_index_iterator* sds_it, struc
ds_sds_session_reset(session);
}
oscap_string_iterator_free(checklist_it);

printf("Checks:\n");
struct oscap_string_iterator* checks_it = ds_stream_index_get_checks(stream);
while (oscap_string_iterator_has_more(checks_it)) {
const char * id = oscap_string_iterator_next(checks_it);
printf("\tRef-Id: %s\n", id);
}
oscap_string_iterator_free(checks_it);

struct oscap_string_iterator* dict_it = ds_stream_index_get_dictionaries(stream);
if (oscap_string_iterator_has_more(dict_it)) {
printf("Dictionaries:\n");
} else {
printf("No dictionaries.\n");
}
while (oscap_string_iterator_has_more(dict_it)) {
const char * id = oscap_string_iterator_next(dict_it);
printf("\tRef-Id: %s\n", id);
}
oscap_string_iterator_free(dict_it);
return OSCAP_OK;
}

Expand Down

0 comments on commit b88b330

Please sign in to comment.