Skip to content

Commit

Permalink
Merge pull request #696 from mattmundell/get-vulns-fail
Browse files Browse the repository at this point in the history
Use standard iterator return checks in handle_get_vulns
  • Loading branch information
timopollmeier authored Aug 15, 2019
2 parents a176c3a + 70d0d7b commit 0feab01
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix RAW_DATA when calling GET_INFO with type NVT without attributes name or info_id [#682](https://github.com/greenbone/gvmd/pull/682)
- Fix ORPHAN calculations in GET_TICKETS [#684](https://github.com/greenbone/gvmd/pull/684) [#692](https://github.com/greenbone/gvmd/pull/692)
- Fix assignment of orphaned tickets to the current user [#685](https://github.com/greenbone/gvmd/pull/685)
- Fix response from GET_VULNS when given vuln_id does not exists [#696](https://github.com/greenbone/gvmd/pull/696)

### Removed
- The handling of NVT updates via OTP has been removed. [#575](https://github.com/greenbone/gvmd/pull/575)
Expand Down
38 changes: 30 additions & 8 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19163,15 +19163,37 @@ handle_get_vulns (gmp_parser_t *gmp_parser, GError **error)
INIT_GET (vuln, Vulnerabilitie);

ret = init_vuln_iterator (&vulns, get);
switch (ret)
if (ret)
{
case 0:
break;
default:
internal_error_send_to_client (error);
get_vulns_data_reset (get_vulns_data);
set_client_state (CLIENT_AUTHENTIC);
return;
switch (ret)
{
case 1:
if (send_find_error_to_client ("get_vulns",
"vuln",
get_vulns_data->get.id,
gmp_parser))
{
error_send_to_client (error);
return;
}
break;
case 2:
if (send_find_error_to_client
("get_vulns", "filter",
get_vulns_data->get.filt_id, gmp_parser))
{
error_send_to_client (error);
return;
}
break;
case -1:
SEND_TO_CLIENT_OR_FAIL
(XML_INTERNAL_ERROR ("get_vulns"));
break;
}
get_vulns_data_reset (get_vulns_data);
set_client_state (CLIENT_AUTHENTIC);
return;
}

SEND_GET_START ("vuln");
Expand Down

0 comments on commit 0feab01

Please sign in to comment.