diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd7fc562..fe2064048 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Cgreen based unit tests for gvmd has been added. [#579](https://github.com/greenbone/gvmd/pull/579) - New usage_type property to distinguish normal scan tasks and configs from compliance audits and policies [#613](https://github.com/greenbone/gvmd/pull/613) [#625](https://github.com/greenbone/gvmd/pull/625) [#633](https://github.com/greenbone/gvmd/pull/633) - Command cleanup-report-formats for --optimize option [#652](https://github.com/greenbone/gvmd/pull/652) +- Document container tasks in GMP doc [#688](https://github.com/greenbone/gvmd/pull/688) ### Changed - Check if NVT preferences exist before inserting. [#406](https://github.com/greenbone/gvmd/pull/406) @@ -31,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Update result diff generation at delta reports [#650](https://github.com/greenbone/gvmd/pull/650) - Check and create default permissions individually [#671](https://github.com/greenbone/gvmd/pull/671) - Add -f arg to sendmail call in email alert [#676](https://github.com/greenbone/gvmd/pull/676) [#678](https://github.com/greenbone/gvmd/pull/678) +- Change get_tickets to use the status text for filtering. [#697](https://github.com/greenbone/gvmd/pull/697) ### Fixed - A PostgreSQL statement order issue [#611](https://github.com/greenbone/gvmd/issues/611) has been addressed [#642](https://github.com/greenbone/gvmd/pull/642) @@ -41,6 +43,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) 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"); diff --git a/src/manage_sql_tickets.c b/src/manage_sql_tickets.c index d66f11a42..e2802a451 100644 --- a/src/manage_sql_tickets.c +++ b/src/manage_sql_tickets.c @@ -79,31 +79,6 @@ ticket_status_integer (const char *status) return TICKET_STATUS_ERROR; } -/** - * @brief Get ticket status name from DB identifier. - * - * @param[in] status Status integer. - * - * @return Status name. - */ -static const gchar * -ticket_status_name (ticket_status_t status) -{ - switch (status) - { - case TICKET_STATUS_OPEN: - return "Open"; - case TICKET_STATUS_FIXED: - return "Fixed"; - case TICKET_STATUS_FIX_VERIFIED: - return "Fix Verified"; - case TICKET_STATUS_CLOSED: - return "Closed"; - default: - return "Error"; - } -} - /** * @brief Filter columns for ticket iterator. */ @@ -157,7 +132,14 @@ ticket_status_name (ticket_status_t status) { "host", NULL, KEYWORD_TYPE_STRING }, \ { "location", NULL, KEYWORD_TYPE_STRING }, \ { "solution_type", NULL, KEYWORD_TYPE_STRING }, \ - { "status", NULL, KEYWORD_TYPE_STRING }, \ + { "(CASE status" \ + " WHEN 0 THEN 'Open'" \ + " WHEN 1 THEN 'Fixed'" \ + " WHEN 2 THEN 'Fix Verified'" \ + " WHEN 3 THEN 'Closed'" \ + " ELSE 'Error' END)", \ + "status", \ + KEYWORD_TYPE_STRING }, \ { "iso_time (open_time)", NULL, KEYWORD_TYPE_STRING }, \ { "open_time", "opened", KEYWORD_TYPE_INTEGER }, \ { "iso_time (fixed_time)", NULL, KEYWORD_TYPE_STRING }, \ @@ -226,7 +208,14 @@ ticket_status_name (ticket_status_t status) { "host", NULL, KEYWORD_TYPE_STRING }, \ { "location", NULL, KEYWORD_TYPE_STRING }, \ { "solution_type", NULL, KEYWORD_TYPE_STRING }, \ - { "status", NULL, KEYWORD_TYPE_STRING }, \ + { "(CASE status" \ + " WHEN 0 THEN 'Open'" \ + " WHEN 1 THEN 'Fixed'" \ + " WHEN 2 THEN 'Fix Verified'" \ + " WHEN 3 THEN 'Closed'" \ + " ELSE 'Error' END)", \ + "status", \ + KEYWORD_TYPE_STRING }, \ { "iso_time (open_time)", NULL, KEYWORD_TYPE_STRING }, \ { "open_time", "opened", KEYWORD_TYPE_INTEGER }, \ { "iso_time (fixed_time)", NULL, KEYWORD_TYPE_STRING }, \ @@ -391,14 +380,7 @@ DEF_ACCESS (ticket_iterator_solution_type, GET_ITERATOR_COLUMN_COUNT + 6); * * @return Status of the ticket or NULL if iteration is complete. */ -const char* -ticket_iterator_status (iterator_t* iterator) -{ - int status; - if (iterator->done) return NULL; - status = iterator_int (iterator, GET_ITERATOR_COLUMN_COUNT + 7); - return ticket_status_name (status); -} +DEF_ACCESS (ticket_iterator_status, GET_ITERATOR_COLUMN_COUNT + 7); /** * @brief Get column value from a ticket iterator. diff --git a/src/schema_formats/XML/GMP.xml.in b/src/schema_formats/XML/GMP.xml.in index 6b4824660..6d73b9c31 100644 --- a/src/schema_formats/XML/GMP.xml.in +++ b/src/schema_formats/XML/GMP.xml.in @@ -5777,6 +5777,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

The client uses the create_task command to create a new task.

+

+ When given a target with an id of 0, the command creates a + "container" task. This kind of task can not be run, but it + is possible to import reports into the task. Importing is + done using the create_report command. The report being + imported must be in the XML format. +

+

+ When creating a container task, the elements config, hosts_ordering, + scanner, alert, schedule, schedule_periods, observers and preferences + are ignored. +

name @@ -5963,6 +5975,22 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Create a container task, for importing reports + + + Container Example + This task provides for importing reports + + + + + + + + create_ticket @@ -20408,6 +20436,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. the values of the sort order, sort field and apply overrides flag that the manager applied when selecting the tasks.

+

+ A task may be a "container" task. This means the task may not be + run, but reports may be uploaded to the task with the command + create_report. Container tasks are identified by having an empty + id attribute in the target element. +

@@ -20899,6 +20933,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. id uuid 1 + ID of target. Empty for container tasks name permissions @@ -21624,6 +21659,108 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Get a single container task + + + + + + + 0 + + + m + + Container Example + This task provides for uploading reports + 2019-08-13T12:28:43+02:00 + + 2019-08-13T12:28:44+02:00 + 1 + 0 + + + Everything + + + 0 + scan + + + -1 + 0 + + + + 0 + + + + + 0 + 0 + + Done + -1 + 1 + 1 + + + + over + 0 + + + + 2019-08-13T12:29:25+02:00 + 2019-04-24T14:26:01+02:00 + 2019-04-24T14:50:59+02:00 + + 0 + 1 + 0 + 77 + 8 + 0 + + 9.0 + + + + + + Maximum concurrently executed NVTs per host + max_checks + 4 + + ... + + + + apply_overrides=0 min_qod=70 + uuid=f404781f-6d2b-420c-b7a1-0d3f27f1a43b first=1 rows=10 + sort=name + + + apply_overrides + = + 0 + + ... + + + + name + ascending + + + 21 + 1 + 1 + + +
get_tickets