diff --git a/src/manage.c b/src/manage.c index a0fc04ccf..8d8d9091c 100644 --- a/src/manage.c +++ b/src/manage.c @@ -1645,6 +1645,7 @@ run_status_name (task_status_t status) return "Stop Requested"; case TASK_STATUS_STOPPED: return "Stopped"; + case TASK_STATUS_PROCESSING: return "Processing"; default: return "Interrupted"; } } @@ -1683,6 +1684,7 @@ run_status_name_internal (task_status_t status) return "Stop Waiting"; case TASK_STATUS_STOPPED: return "Stopped"; + case TASK_STATUS_PROCESSING: return "Processing"; default: return "Interrupted"; } } @@ -2869,6 +2871,9 @@ fork_osp_scan_handler (task_t task, target_t target, int from, g_free (report_id); if (rc == 0) { + set_task_run_status (task, TASK_STATUS_PROCESSING); + set_report_scan_run_status (global_current_report, + TASK_STATUS_PROCESSING); hosts_set_identifiers (global_current_report); hosts_set_max_severity (global_current_report, NULL, NULL); hosts_set_details (global_current_report); @@ -3895,6 +3900,7 @@ move_task (const char *task_id, const char *slave_id) case TASK_STATUS_DELETE_WAITING: case TASK_STATUS_DELETE_ULTIMATE_WAITING: case TASK_STATUS_REQUESTED: + case TASK_STATUS_PROCESSING: // Task cannot be stopped now return 5; break; diff --git a/src/manage.h b/src/manage.h index eecaddd21..187b8a74d 100644 --- a/src/manage.h +++ b/src/manage.h @@ -283,7 +283,8 @@ typedef enum /* 15 was removed (TASK_STATUS_STOP_REQUESTED_GIVEUP). */ TASK_STATUS_DELETE_WAITING = 16, TASK_STATUS_DELETE_ULTIMATE_WAITING = 17, - TASK_STATUS_QUEUED = 18 + TASK_STATUS_QUEUED = 18, + TASK_STATUS_PROCESSING = 19, } task_status_t; /** diff --git a/src/manage_pg.c b/src/manage_pg.c index 695b81063..34fcd7c62 100644 --- a/src/manage_pg.c +++ b/src/manage_pg.c @@ -976,7 +976,7 @@ manage_create_sql_functions () " WHEN (SELECT scan_run_status FROM reports" " WHERE reports.id = $1)" " IN (SELECT unnest (ARRAY [%i, %i, %i, %i, %i," - " %i, %i, %i]))" + " %i, %i, %i, %i]))" " THEN true" " ELSE false" " END;" @@ -988,7 +988,8 @@ manage_create_sql_functions () TASK_STATUS_STOP_REQUESTED, TASK_STATUS_STOPPED, TASK_STATUS_INTERRUPTED, - TASK_STATUS_QUEUED); + TASK_STATUS_QUEUED, + TASK_STATUS_PROCESSING); sql ("CREATE OR REPLACE FUNCTION report_progress (integer)" " RETURNS integer AS $$" @@ -1391,6 +1392,8 @@ manage_create_sql_functions () " THEN 'Stopped'" " WHEN $1 = %i" " THEN 'Queued'" + " WHEN $1 = %i" + " THEN 'Processing'" " ELSE 'Interrupted'" " END;" "$$ LANGUAGE SQL" @@ -1406,7 +1409,8 @@ manage_create_sql_functions () TASK_STATUS_STOP_REQUESTED, TASK_STATUS_STOP_WAITING, TASK_STATUS_STOPPED, - TASK_STATUS_QUEUED); + TASK_STATUS_QUEUED, + TASK_STATUS_PROCESSING); if (sql_int ("SELECT EXISTS (SELECT * FROM information_schema.tables" " WHERE table_catalog = '%s'" diff --git a/src/manage_sql.c b/src/manage_sql.c index 459486cbc..6040bf84a 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -2584,7 +2584,8 @@ keyword_applies_to_column (keyword_t *keyword, const char* column) && (strstr ("Queued", keyword->string) == NULL) && (strstr ("Stop Requested", keyword->string) == NULL) && (strstr ("Stopped", keyword->string) == NULL) - && (strstr ("Interrupted", keyword->string) == NULL)) + && (strstr ("Interrupted", keyword->string) == NULL) + && (strstr ("Processing", keyword->string) == NULL)) return 0; return 1; } @@ -15420,7 +15421,8 @@ task_in_use (task_t task) || status == TASK_STATUS_RUNNING || status == TASK_STATUS_QUEUED || status == TASK_STATUS_STOP_REQUESTED - || status == TASK_STATUS_STOP_WAITING; + || status == TASK_STATUS_STOP_WAITING + || status == TASK_STATUS_PROCESSING; } /** @@ -16530,6 +16532,7 @@ stop_active_tasks () case TASK_STATUS_QUEUED: case TASK_STATUS_STOP_REQUESTED: case TASK_STATUS_STOP_WAITING: + case TASK_STATUS_PROCESSING: { task_t index = get_iterator_resource (&tasks); /* Set the current user, for event checks. */ @@ -16562,6 +16565,7 @@ stop_active_tasks () " OR scan_run_status = %u" " OR scan_run_status = %u" " OR scan_run_status = %u" + " OR scan_run_status = %u" " OR scan_run_status = %u;", TASK_STATUS_INTERRUPTED, TASK_STATUS_DELETE_REQUESTED, @@ -16572,7 +16576,8 @@ stop_active_tasks () TASK_STATUS_RUNNING, TASK_STATUS_QUEUED, TASK_STATUS_STOP_REQUESTED, - TASK_STATUS_STOP_WAITING); + TASK_STATUS_STOP_WAITING, + TASK_STATUS_PROCESSING); } /** @@ -18157,7 +18162,8 @@ task_iterator_current_report (iterator_t *iterator) || run_status == TASK_STATUS_DELETE_ULTIMATE_REQUESTED || run_status == TASK_STATUS_STOP_REQUESTED || run_status == TASK_STATUS_STOPPED - || run_status == TASK_STATUS_INTERRUPTED) + || run_status == TASK_STATUS_INTERRUPTED + || run_status == TASK_STATUS_PROCESSING) { return (unsigned int) sql_int ("SELECT max(id) FROM reports" " WHERE task = %llu" @@ -18168,6 +18174,7 @@ task_iterator_current_report (iterator_t *iterator) " OR scan_run_status = %u" " OR scan_run_status = %u" " OR scan_run_status = %u" + " OR scan_run_status = %u" " OR scan_run_status = %u);", task, TASK_STATUS_REQUESTED, @@ -18177,7 +18184,8 @@ task_iterator_current_report (iterator_t *iterator) TASK_STATUS_DELETE_ULTIMATE_REQUESTED, TASK_STATUS_STOP_REQUESTED, TASK_STATUS_STOPPED, - TASK_STATUS_INTERRUPTED); + TASK_STATUS_INTERRUPTED, + TASK_STATUS_PROCESSING); } return (report_t) 0; } @@ -52325,6 +52333,7 @@ delete_user (const char *user_id_arg, const char *name_arg, int ultimate, case TASK_STATUS_QUEUED: case TASK_STATUS_STOP_REQUESTED: case TASK_STATUS_STOP_WAITING: + case TASK_STATUS_PROCESSING: { cleanup_iterator (&tasks); free (current_credentials.uuid); diff --git a/src/schema_formats/XML/GMP.xml.in b/src/schema_formats/XML/GMP.xml.in index 2476f04a2..664e350d1 100644 --- a/src/schema_formats/XML/GMP.xml.in +++ b/src/schema_formats/XML/GMP.xml.in @@ -168,7 +168,7 @@ along with this program. If not, see . task_status A task run status - xsd:token { pattern = "Delete Requested|Done|New|Requested|Running|Stop Requested|Stopped|Interrupted" } + xsd:token { pattern = "Delete Requested|Done|New|Processing|Requested|Running|Stop Requested|Stopped|Interrupted" }