Skip to content

Commit

Permalink
Merge branch 'main' into cves-from-json
Browse files Browse the repository at this point in the history
  • Loading branch information
a-h-abdelsalam authored Nov 6, 2024
2 parents 6ff3d18 + 9b155fb commit 4a52a60
Show file tree
Hide file tree
Showing 5 changed files with 456 additions and 547 deletions.
13 changes: 0 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,25 +247,12 @@ if (NOT CVSS3_RATINGS)
endif (NOT CVSS3_RATINGS)
add_definitions (-DCVSS3_RATINGS=${CVSS3_RATINGS})

if (NOT COMPLIANCE_REPORTS)
set (COMPLIANCE_REPORTS 1)
endif (NOT COMPLIANCE_REPORTS)
add_definitions (-DCOMPLIANCE_REPORTS=${COMPLIANCE_REPORTS})

message ("-- Install prefix: ${CMAKE_INSTALL_PREFIX}")

## Version

set (GVMD_VERSION "${PROJECT_VERSION_STRING}")

if (COMPLIANCE_REPORTS EQUAL 1)
set(IF_COMPLIANCE_REPORTS "")
set(ENDIF_COMPLIANCE_REPORTS "")
elseif (COMPLIANCE_REPORTS EQUAL 0)
set(IF_COMPLIANCE_REPORTS "<!--")
set(ENDIF_COMPLIANCE_REPORTS "-->")
endif()

# Configure Doxyfile with version number
configure_file (doc/Doxyfile.in doc/Doxyfile)
configure_file (doc/Doxyfile_full.in doc/Doxyfile_full)
Expand Down
49 changes: 17 additions & 32 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -12958,11 +12958,6 @@ handle_get_features (gmp_parser_t *gmp_parser, GError **error)
" status=\"" STATUS_OK "\""
" status_text=\"" STATUS_OK_TEXT "\">");

SENDF_TO_CLIENT_OR_FAIL ("<feature enabled=\"%d\">"
"<name>COMPLIANCE_REPORTS</name>"
"</feature>",
COMPLIANCE_REPORTS ? 1 : 0);

SENDF_TO_CLIENT_OR_FAIL ("<feature enabled=\"%d\">"
"<name>CVSS3_RATINGS</name>"
"</feature>",
Expand Down Expand Up @@ -15134,31 +15129,23 @@ handle_get_reports (gmp_parser_t *gmp_parser, GError **error)
overrides = filter_term_apply_overrides (filter ? filter : get->filter);
min_qod = filter_term_min_qod (filter ? filter : get->filter);
levels = filter_term_value (filter ? filter : get->filter, "levels");
#if COMPLIANCE_REPORTS == 1
gchar *compliance_levels;
compliance_levels = filter_term_value (filter
? filter
: get->filter,
"compliance_levels");

/* Setup result filter from overrides. */
get_reports_data->get.filter
= g_strdup_printf
("apply_overrides=%i min_qod=%i levels=%s compliance_levels=%s",
overrides,
min_qod,
levels ? levels : "hmlgdf",
compliance_levels ? compliance_levels : "yniu");
g_free (compliance_levels);
#else
/* Setup result filter from overrides. */
get_reports_data->get.filter
= g_strdup_printf
("apply_overrides=%i min_qod=%i levels=%s",
overrides,
min_qod,
levels ? levels : "hmlgdf");
#endif

gchar *compliance_levels;
compliance_levels = filter_term_value (filter
? filter
: get->filter,
"compliance_levels");

/* Setup result filter from overrides. */
get_reports_data->get.filter
= g_strdup_printf
("apply_overrides=%i min_qod=%i levels=%s compliance_levels=%s",
overrides,
min_qod,
levels ? levels : "hmlgdf",
compliance_levels ? compliance_levels : "yniu");
g_free (compliance_levels);

g_free (filter);
g_free (levels);
}
Expand Down Expand Up @@ -16206,7 +16193,6 @@ select_resource_iterator (get_resource_names_data_t *resource_names_data,
else if (g_strcmp0 ("report", resource_names_data->type) == 0)
{
*iterator = (int (*) (iterator_t*, get_data_t *))init_report_iterator;
#if COMPLIANCE_REPORTS == 1
get_data_set_extra (&resource_names_data->get,
"usage_type",
g_strdup ("scan"));
Expand All @@ -16217,7 +16203,6 @@ select_resource_iterator (get_resource_names_data_t *resource_names_data,
get_data_set_extra (&resource_names_data->get,
"usage_type",
g_strdup ("audit"));
#endif
}
else if (g_strcmp0 ("report_config", resource_names_data->type) == 0)
{
Expand Down
3 changes: 0 additions & 3 deletions src/gvmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2324,9 +2324,6 @@ gvmd (int argc, char** argv, char *env[])
#endif
#if CVSS3_RATINGS == 1
printf ("CVSS3 severity ratings enabled\n");
#endif
#if COMPLIANCE_REPORTS == 1
printf ("Compliance reports enabled\n");
#endif
printf ("Copyright (C) 2009-2021 Greenbone AG\n");
printf ("License: AGPL-3.0-or-later\n");
Expand Down
Loading

0 comments on commit 4a52a60

Please sign in to comment.