Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop autofp #1300

Merged
merged 23 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e3a4c7a
Remove autofp from result_iterator_opts_table().
janowagner Sep 10, 2020
9eb6890
Remove autofp from results_extra_where().
janowagner Sep 10, 2020
4fa2d39
Remove autofp from manage_report_filter_control()
janowagner Sep 10, 2020
63bd3a4
Remove autofp handling from report_severity_data()
janowagner Sep 12, 2020
b2f64c3
Remove autofp from report_counts()
janowagner Sep 13, 2020
9e39b9c
Remove filter_term_autofp()
janowagner Sep 13, 2020
3bf8c8f
Remove handling of "autofp" in filter string.
janowagner Sep 13, 2020
811a5ba
Remove autofp for columns.
janowagner Sep 13, 2020
72b3041
Remove unneeded proto.
janowagner Sep 13, 2020
99a6608
Drop param autofp from report_results_get_data()
janowagner Sep 13, 2020
46d6630
Drop autofp from report_results_filter_term()
janowagner Sep 13, 2020
6a29f12
For type do not consider autofp anymore.
janowagner Sep 13, 2020
2b112aa
Remove autfp from results interator.
janowagner Sep 13, 2020
5116bd9
Remove SQL view for autofp.
janowagner Sep 13, 2020
45921c5
Remove auto_type_sql from where_levels_auto()
janowagner Sep 14, 2020
f3f0e85
Drop auto_type from REPORT_ITERATOR_FILTER_COLUMNS
janowagner Sep 16, 2020
46f95ab
Drop the elements from GMP XML spec.
janowagner Sep 16, 2020
8325a47
Add Changelog.
janowagner Sep 29, 2020
fcda896
Drop auto_type_sql use.
janowagner Oct 5, 2020
804a82b
Formatting fix.
janowagner Oct 5, 2020
c152989
Formatting issue.
janowagner Oct 5, 2020
bb5a4d2
Remove redudante SQL brackets.
janowagner Oct 5, 2020
57ffc48
Adjust to itertor change.
janowagner Oct 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -15275,7 +15275,6 @@ handle_get_results (gmp_parser_t *gmp_parser, GError **error)
NULL, /* delta_states */
NULL, /* search_phrase */
NULL, /* search_phrase_exact */
NULL, /* autofp */
&notes,
&overrides,
NULL, /* apply_overrides */
Expand Down
2 changes: 1 addition & 1 deletion src/manage.h
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ manage_filter_controls (const gchar *, int *, int *, gchar **, int *);
void
manage_report_filter_controls (const gchar *, int *, int *, gchar **, int *,
int *, gchar **, gchar **, gchar **, gchar **,
int *, int *, int *, int *, int *, gchar **);
int *, int *, int *, int *, gchar **);

gchar *
manage_clean_filter (const gchar *);
Expand Down
80 changes: 20 additions & 60 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,6 @@ filter_control_str (keyword_t **point, const char *column, gchar **string)
* @param[out] search_phrase Phrase that results must include. All results
* if NULL or "".
* @param[out] search_phrase_exact Whether search phrase is exact.
* @param[out] autofp Whether to apply auto FP filter.
* @param[out] notes Whether to include notes.
* @param[out] overrides Whether to include overrides.
* @param[out] apply_overrides Whether to apply overrides.
Expand All @@ -2022,7 +2021,7 @@ manage_report_filter_controls (const gchar *filter, int *first, int *max,
int *result_hosts_only, gchar **min_qod,
gchar **levels, gchar **delta_states,
gchar **search_phrase, int *search_phrase_exact,
int *autofp, int *notes, int *overrides,
int *notes, int *overrides,
int *apply_overrides, gchar **zone)
{
keyword_t **point;
Expand Down Expand Up @@ -2147,16 +2146,6 @@ manage_report_filter_controls (const gchar *filter, int *first, int *max,
*result_hosts_only = val;
}

if (autofp)
{
if (filter_control_int ((keyword_t **) split->pdata,
"autofp",
&val))
*autofp = 0;
else
*autofp = val;
}

if (notes)
{
if (filter_control_int ((keyword_t **) split->pdata,
Expand Down Expand Up @@ -21682,14 +21671,13 @@ where_qod (int min_qod)
/**
* @brief Generate the extra_tables string for a result iterator.
*
* @param[in] autofp Whether to apply auto FP filter.
* @param[in] override Whether to apply overrides.
* @param[in] dynamic Whether to use dynamic severity scores.
*
* @return Newly allocated string with the extra_tables clause.
*/
static gchar*
result_iterator_opts_table (int autofp, int override, int dynamic)
result_iterator_opts_table (int override, int dynamic)
{
user_t user_id;
gchar *user_zone, *quoted_user_zone, *ret;
Expand Down Expand Up @@ -21724,12 +21712,10 @@ result_iterator_opts_table (int autofp, int override, int dynamic)
(", (SELECT"
" '%s'::text AS user_zone,"
" %llu AS user_id,"
" %d AS autofp,"
" %d AS override,"
" %d AS dynamic) AS opts",
quoted_user_zone,
user_id,
autofp,
override,
dynamic);

Expand All @@ -21744,7 +21730,6 @@ result_iterator_opts_table (int autofp, int override, int dynamic)
* @param[in] trash Whether to get results from trashcan.
* @param[in] report Report to restrict returned results to.
* @param[in] host Host to restrict returned results to.
* @param[in] autofp Whether to apply auto FP filter.
* @param[in] apply_overrides Whether to apply overrides.
* @param[in] dynamic_severity Whether to use dynamic severity.
* @param[in] filter Filter string.
Expand All @@ -21753,7 +21738,7 @@ result_iterator_opts_table (int autofp, int override, int dynamic)
*/
static gchar*
results_extra_where (int trash, report_t report, const gchar* host,
int autofp, int apply_overrides, int dynamic_severity,
int apply_overrides, int dynamic_severity,
const gchar *filter)
{
gchar *extra_where;
Expand All @@ -21771,25 +21756,7 @@ results_extra_where (int trash, report_t report, const gchar* host,

// Build clause fragments

switch (autofp)
{
case 1:
auto_type_sql = g_strdup_printf
("(SELECT autofp FROM results_autofp"
" WHERE result = results.id"
" AND autofp_selection = 1)");
break;
case 2:
auto_type_sql = g_strdup_printf
("(SELECT autofp FROM results_autofp"
" WHERE result = results.id"
" AND autofp_selection = 2)");
break;

default:
auto_type_sql = g_strdup ("NULL");
break;
}
auto_type_sql = g_strdup ("NULL");

new_severity_sql
= g_strdup_printf ("(SELECT new_severity FROM result_new_severities"
Expand Down Expand Up @@ -22009,11 +21976,11 @@ init_result_get_iterator_severity (iterator_t* iterator, const get_data_t *get,
if (autofp == 0)
columns[0].select = "0";

extra_tables = result_iterator_opts_table (autofp, apply_overrides,
extra_tables = result_iterator_opts_table (apply_overrides,
dynamic_severity);

extra_where = results_extra_where (get->trash, report, host,
autofp, apply_overrides, dynamic_severity,
apply_overrides, dynamic_severity,
filter ? filter : get->filter);

free (filter);
Expand Down Expand Up @@ -22105,7 +22072,7 @@ init_result_get_iterator (iterator_t* iterator, const get_data_t *get,
static column_t columns_no_cert[] = RESULT_ITERATOR_COLUMNS_NO_CERT;
int ret;
gchar *filter, *extra_tables, *extra_where, *opts_tables;
int autofp, apply_overrides, dynamic_severity;
int apply_overrides, dynamic_severity;

if (report == -1)
{
Expand All @@ -22124,18 +22091,16 @@ init_result_get_iterator (iterator_t* iterator, const get_data_t *get,

apply_overrides
= filter_term_apply_overrides (filter ? filter : get->filter);
autofp = filter_term_autofp (filter ? filter : get->filter);
dynamic_severity = setting_dynamic_severity_int ();

opts_tables
= result_iterator_opts_table (autofp, apply_overrides, dynamic_severity);
opts_tables = result_iterator_opts_table (apply_overrides, dynamic_severity);
extra_tables = g_strdup_printf (" LEFT OUTER JOIN nvts"
" ON results.nvt = nvts.oid %s",
opts_tables);
g_free (opts_tables);

extra_where = results_extra_where (get->trash, report, host,
autofp, apply_overrides, dynamic_severity,
apply_overrides, dynamic_severity,
filter ? filter : get->filter);

free (filter);
Expand Down Expand Up @@ -22179,7 +22144,7 @@ result_count (const get_data_t *get, report_t report, const char* host)
static column_t columns_no_cert[] = RESULT_ITERATOR_COLUMNS_NO_CERT;
int ret;
gchar *filter, *extra_tables, *extra_where, *opts_tables;
int apply_overrides, autofp, dynamic_severity;
int apply_overrides, dynamic_severity;

if (report == -1)
return 0;
Expand All @@ -22195,18 +22160,16 @@ result_count (const get_data_t *get, report_t report, const char* host)

apply_overrides
= filter_term_apply_overrides (filter ? filter : get->filter);
autofp = filter_term_autofp (filter ? filter : get->filter);
dynamic_severity = setting_dynamic_severity_int ();

opts_tables
= result_iterator_opts_table (autofp, apply_overrides, dynamic_severity);
opts_tables = result_iterator_opts_table (apply_overrides, dynamic_severity);
extra_tables = g_strdup_printf (" LEFT OUTER JOIN nvts"
" ON results.nvt = nvts.oid %s",
opts_tables);
g_free (opts_tables);

extra_where = results_extra_where (get->trash, report, host,
autofp, apply_overrides, dynamic_severity,
apply_overrides, dynamic_severity,
filter ? filter : get->filter);

ret = count ("result", get,
Expand Down Expand Up @@ -23620,7 +23583,7 @@ report_severity_data (report_t report, const char *host,
iterator_t results;

gchar *filter;
int apply_overrides, autofp;
int apply_overrides ;
mattmundell marked this conversation as resolved.
Show resolved Hide resolved

if (report == 0)
return;
Expand All @@ -23634,13 +23597,12 @@ report_severity_data (report_t report, const char *host,

apply_overrides
= filter_term_apply_overrides (filter ? filter : get->filter);
autofp = filter_term_autofp (filter ? filter : get->filter);

if (severity_data)
{
get_data_t *get_all;

get_all = report_results_get_data (1, -1, apply_overrides, autofp, 0);
get_all = report_results_get_data (1, -1, apply_overrides, 0, 0);
ignore_max_rows_per_page = 1;
init_result_get_iterator_severity (&results, get_all, report, host, NULL);
ignore_max_rows_per_page = 0;
Expand Down Expand Up @@ -26994,7 +26956,7 @@ print_report_xml_start (report_t report, report_t delta, task_t task,
int result_hosts_only;
int notes, overrides;

int first_result, max_results, sort_order, autofp;
int first_result, max_results, sort_order;

FILE *out;
gchar *clean, *term, *sort_field, *levels, *search_phrase;
Expand Down Expand Up @@ -27084,7 +27046,7 @@ print_report_xml_start (report_t report, report_t delta, task_t task,
&sort_order, &result_hosts_only,
&min_qod, &levels, &delta_states,
&search_phrase, &search_phrase_exact,
&autofp, &notes, &overrides,
&notes, &overrides,
&apply_overrides, &zone);
}
else
Expand All @@ -27096,7 +27058,7 @@ print_report_xml_start (report_t report, report_t delta, task_t task,
&sort_order, &result_hosts_only,
&min_qod, &levels, &delta_states,
&search_phrase, &search_phrase_exact,
&autofp, &notes, &overrides,
&notes, &overrides,
&apply_overrides, &zone);
}

Expand Down Expand Up @@ -54453,8 +54415,7 @@ type_opts_table (const char *type, const char *filter)
return report_iterator_opts_table (filter_term_apply_overrides (filter),
filter_term_min_qod (filter));
if (strcasecmp (type, "RESULT") == 0)
return result_iterator_opts_table (filter_term_autofp (filter),
filter_term_apply_overrides (filter),
return result_iterator_opts_table (filter_term_apply_overrides (filter),
setting_dynamic_severity_int ());
if (strcasecmp (type, "VULN") == 0)
{
Expand Down Expand Up @@ -54552,7 +54513,7 @@ type_extra_where (const char *type, int trash, const char *filter,
}
else if (strcasecmp (type, "RESULT") == 0)
{
int autofp, apply_overrides;
int apply_overrides;
gchar *report_id;
report_t report;

Expand All @@ -54579,11 +54540,10 @@ type_extra_where (const char *type, int trash, const char *filter,
}
g_free (report_id);

autofp = filter_term_autofp (filter);
apply_overrides = filter_term_apply_overrides (filter);

extra_where = results_extra_where (trash, report, NULL,
autofp, apply_overrides,
apply_overrides,
setting_dynamic_severity_int (),
filter);
}
Expand Down