Skip to content

Commit

Permalink
Merge pull request #954 from timopollmeier/fix-nvt-qod-master
Browse files Browse the repository at this point in the history
Fix QoD handling in nvti cache and test_alert (master)
  • Loading branch information
mattmundell authored Jan 23, 2020
2 parents b4d6aef + b6458ec commit d729408
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add tags used for result NVTs to update_nvti_cache [#916](https://github.com/greenbone/gvmd/pull/916)
- Apply usage_type of tasks in get_aggregates (9.0) [#912](https://github.com/greenbone/gvmd/pull/912)
- Add target's alive test method before starting a scan. [#947](https://github.com/greenbone/gvmd/pull/947)
- Fix QoD handling in nvti cache and test_alert [#954](https://github.com/greenbone/gvmd/pull/954)

### Removed
- Remove support for "All SecInfo": removal of "allinfo" for type in get_info [#790](https://github.com/greenbone/gvmd/pull/790)
Expand Down
21 changes: 9 additions & 12 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -15430,7 +15430,7 @@ update_nvti_cache ()
"SELECT nvts.oid, nvts.name, nvts.family, nvts.cvss_base,"
" nvts.tag, nvts.solution, nvts.solution_type,"
" nvts.summary, nvts.insight, nvts.affected,"
" nvts.impact, nvts.detection,"
" nvts.impact, nvts.detection, nvts.qod_type,"
" vt_refs.type, vt_refs.ref_id, vt_refs.ref_text"
" FROM nvts"
" LEFT OUTER JOIN vt_refs ON nvts.oid = vt_refs.vt_oid;");
Expand All @@ -15455,17 +15455,18 @@ update_nvti_cache ()
nvti_set_affected (nvti, iterator_string (&nvts, 9));
nvti_set_impact (nvti, iterator_string (&nvts, 10));
nvti_set_detection (nvti, iterator_string (&nvts, 11));
nvti_set_qod_type (nvti, iterator_string (&nvts, 12));

nvtis_add (nvti_cache, nvti);
}

if (iterator_null (&nvts, 13))
if (iterator_null (&nvts, 14))
/* No refs. */;
else
nvti_add_vtref (nvti,
vtref_new (iterator_string (&nvts, 12),
iterator_string (&nvts, 13),
iterator_string (&nvts, 14)));
vtref_new (iterator_string (&nvts, 13),
iterator_string (&nvts, 14),
iterator_string (&nvts, 15)));
}

cleanup_iterator (&nvts);
Expand Down Expand Up @@ -20159,16 +20160,12 @@ make_result (task_t task, const char* host, const char *hostname,
nvti = lookup_nvti (nvt);
if (nvti)
{
gchar *qod_str, *qod_type;
qod_str = nvti_get_tag (nvti, "qod");
qod_type = nvti_get_tag (nvti, "qod_type");

if (qod_str == NULL || sscanf (qod_str, "%d", &qod) != 1)
qod = qod_from_type (qod_type);
gchar *qod_type;

qod_type = nvti_qod_type (nvti);
qod = qod_from_type (qod_type);
quoted_qod_type = sql_quote (qod_type);

g_free (qod_str);
g_free (qod_type);
}
else
Expand Down

0 comments on commit d729408

Please sign in to comment.