From c39b5a3e6ea99f90e42d667ec2d6426b39fa1ed8 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Wed, 14 Aug 2019 16:03:07 +0200 Subject: [PATCH 1/2] Use standard iterator return checks in handle_get_vulns --- src/gmp.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/gmp.c b/src/gmp.c index d199c4928..d4e442801 100644 --- a/src/gmp.c +++ b/src/gmp.c @@ -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"); From 464f2e6abe8697884bfa9ab2394ec03d687bd060 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Wed, 14 Aug 2019 16:05:39 +0200 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1321524fc..e0b8352db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 calculation in GET_TICKETS [#684](https://github.com/greenbone/gvmd/pull/684) - 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)