diff --git a/src/gmp.c b/src/gmp.c index db1d42baa..88d577699 100644 --- a/src/gmp.c +++ b/src/gmp.c @@ -759,7 +759,7 @@ typedef struct array_t *results; ///< All results. char *scan_end; ///< End time for a scan. char *scan_start; ///< Start time for a scan. - char *task_id; ///< ID of container task. + char *task_id; ///< ID of import task. char *type; ///< Type of report. int wrapper; ///< Whether there was a wrapper REPORT. } create_report_data_t; @@ -19859,7 +19859,7 @@ handle_get_tasks (gmp_parser_t *gmp_parser, GError **error) } else { - /* Container tasks have no associated scanner. */ + /* Import tasks have no associated scanner. */ task_scanner_uuid = g_strdup (""); task_scanner_name = g_strdup (""); task_scanner_type = 0; @@ -23781,7 +23781,7 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context, case -5: SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("create_report", - "TASK must be a container")); + "TASK must be an import task")); log_event_fail ("report", "Report", NULL, "created"); break; case -6: @@ -24987,7 +24987,7 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context, && !is_agent_task && !is_container_scanning_task) { - /* Container task. */ + /* Import task. */ set_task_target (create_task_data->task, 0); set_task_usage_type (create_task_data->task, @@ -27997,7 +27997,7 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context, case 17: SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("modify_task", - "For container tasks only name, comment" + "For import tasks only name, comment" " and observers can be modified")); log_event_fail ("task", "Task", modify_task_data->task_id, @@ -28796,7 +28796,7 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context, "started"); break; case -2: - /* Task lacks target. This is true for container + /* Task lacks target. This is true for Import * tasks. */ SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("start_task", diff --git a/src/manage_pg.c b/src/manage_pg.c index 95695a3b4..ea723e25f 100644 --- a/src/manage_pg.c +++ b/src/manage_pg.c @@ -1513,7 +1513,7 @@ manage_create_sql_functions () /* Get trend only for authenticated users. */ " WHEN gvmd_user () = 0" " THEN RETURN ''::text;" - /* Skip running and container tasks. */ + /* Skip running and import tasks. */ " WHEN (SELECT run_status = %u OR target = 0" " FROM tasks WHERE id = $1)" " THEN RETURN ''::text;" diff --git a/src/manage_sql.c b/src/manage_sql.c index 641f70188..0b5a8087e 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -7828,7 +7828,7 @@ task_severity_double (task_t task, int overrides, int min_qod, int offset) report_t report; if (current_credentials.uuid == NULL - || task_target (task) == 0 /* Container task. */) + || task_target (task) == 0 /* import task. */) return SEVERITY_MISSING; report = sql_int64_0 ("SELECT id FROM reports" @@ -9927,7 +9927,7 @@ process_report_import (report_t report) * @brief Create a report from an array of results. * * @param[in] results Array of create_report_result_t pointers. - * @param[in] task_id UUID of container task, or NULL to create new one. + * @param[in] task_id UUID of import task, or NULL to create new one. * @param[in] in_assets Whether to create assets from the report. * @param[in] scan_start Scan start time text. * @param[in] scan_end Scan end time text. @@ -9940,7 +9940,7 @@ process_report_import (report_t report) * * @return 0 success, 99 permission denied, -1 error, -2 failed to generate ID, * -3 task_id is NULL, -4 failed to find task, -5 task must be - * container, -6 permission to create assets denied. + * import task, -6 permission to create assets denied. */ int create_report (array_t *results, const char *task_id, const char *in_assets, @@ -20820,7 +20820,7 @@ DEF_ACCESS (task_file_iterator_content, 1); * alterable state, 10 failed to find group, 11 failed to find schedule, * 12 failed to find target, 13 invalid auto_delete value, 14 auto * delete count out of range, 15 config and scanner types mismatch, - * 16 status must be new to edit target, 17 for container tasks only + * 16 status must be new to edit target, 17 for import tasks only * certain fields may be edited, 18 failed to find agent group, 19 failed to find OCI image target, -1 error. */ diff --git a/src/manage_sql_filters.c b/src/manage_sql_filters.c index 4cebc4c5f..c90f7b21f 100644 --- a/src/manage_sql_filters.c +++ b/src/manage_sql_filters.c @@ -1188,9 +1188,15 @@ filter_clause (const char* type, const char* filter, g_string_append_printf (order, " ORDER BY" - " (CASE WHEN (SELECT target = 0 FROM tasks" + " (CASE WHEN (SELECT " + " ( " + " target = 0 " + " and COALESCE( agent_group, 0) = 0 " + " and COALESCE( oci_image_target, 0) = 0" + " ) " + " FROM tasks" " WHERE tasks.id = task)" - " THEN 'Container'" + " THEN '0'" " ELSE run_status_name (scan_run_status)" " || (SELECT CAST (temp / 100 AS text)" " || CAST (temp / 10 AS text)" @@ -1204,8 +1210,11 @@ filter_clause (const char* type, const char* filter, g_string_append_printf (order, " ORDER BY" - " (CASE WHEN target = 0" - " THEN 'Container'" + " (CASE WHEN ( target = 0 " + " and COALESCE( agent_group, 0) = 0 " + " and COALESCE( oci_image_target, 0) = 0" + " ) " + " THEN '0'" " ELSE run_status_name (run_status)" " || (SELECT CAST (temp / 100 AS text)" " || CAST (temp / 10 AS text)" @@ -1384,9 +1393,15 @@ filter_clause (const char* type, const char* filter, g_string_append_printf (order, " ORDER BY" - " (CASE WHEN (SELECT target = 0 FROM tasks" + " (CASE WHEN (SELECT " + " ( " + " target = 0 " + " and COALESCE( agent_group, 0) = 0 " + " and COALESCE( oci_image_target, 0) = 0" + " ) " + " FROM tasks" " WHERE tasks.id = task)" - " THEN 'Container'" + " THEN '0'" " ELSE run_status_name (scan_run_status)" " || (SELECT CAST (temp / 100 AS text)" " || CAST (temp / 10 AS text)" @@ -1400,8 +1415,11 @@ filter_clause (const char* type, const char* filter, g_string_append_printf (order, " ORDER BY" - " (CASE WHEN target = 0" - " THEN 'Container'" + " (CASE WHEN ( target = 0 " + " and COALESCE( agent_group, 0) = 0 " + " and COALESCE( oci_image_target, 0) = 0" + " ) " + " THEN '0'" " ELSE run_status_name (run_status)" " || (SELECT CAST (temp / 100 AS text)" " || CAST (temp / 10 AS text)" diff --git a/src/schema_formats/XML/GMP.xml.in b/src/schema_formats/XML/GMP.xml.in index f6059099d..0986b3c84 100644 --- a/src/schema_formats/XML/GMP.xml.in +++ b/src/schema_formats/XML/GMP.xml.in @@ -6400,14 +6400,14 @@ END:VCALENDAR 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 + When given a target with an id of 0, the command creates an + "import" 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, + When creating an import task, the elements config, hosts_ordering, scanner, alert, schedule, schedule_periods, observers and preferences are ignored.

@@ -6644,10 +6644,10 @@ END:VCALENDAR - Create a container task, for importing reports + Create an import task, for importing reports - Container Example + Import Example This task provides for importing reports @@ -25898,9 +25898,9 @@ END:VCALENDAR that the manager applied when selecting the tasks.

- A task may be a "container" task. This means the task may not be + A task may be an "import" 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 + create_report. Import tasks are identified by having an empty id attribute in the target element.

@@ -26442,7 +26442,7 @@ END:VCALENDAR id uuid 1 - ID of target. Empty for container tasks + ID of target. Empty for import tasks name permissions @@ -27185,7 +27185,7 @@ END:VCALENDAR
- Get a single container task + Get a single import task @@ -27197,7 +27197,7 @@ END:VCALENDAR m - Container Example + Import Example This task provides for uploading reports 2019-08-13T12:28:43+02:00