From 630329e924ccf9a1b2c7a6ce45bda8b460922bf9 Mon Sep 17 00:00:00 2001 From: Timo Pollmeier Date: Tue, 21 Jan 2020 10:21:49 +0100 Subject: [PATCH] Set run status only after getting OSP-OpenVAS scan This addresses issues with the start time being undefined while the status is already set to "Running", e.g. during sensor scans. --- src/manage.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/manage.c b/src/manage.c index 72ff03938..329b77a7b 100644 --- a/src/manage.c +++ b/src/manage.c @@ -3560,6 +3560,7 @@ handle_osp_scan (task_t task, report_t report, const char *scan_id) char *host, *ca_pub, *key_pub, *key_priv; int rc, port; scanner_t scanner; + gboolean started = FALSE; scanner = task_scanner (task); host = scanner_host (scanner); @@ -3642,6 +3643,13 @@ handle_osp_scan (task_t task, report_t report, const char *scan_id) rc = 0; break; } + else if (osp_scan_status == OSP_SCAN_STATUS_RUNNING + && started == FALSE) + { + set_task_run_status (task, TASK_STATUS_RUNNING); + set_report_scan_run_status (global_current_report, + TASK_STATUS_RUNNING); + } } } } @@ -4502,9 +4510,6 @@ fork_osp_scan_handler (task_t task, target_t target, int from, exit (-1); } - set_task_run_status (task, TASK_STATUS_RUNNING); - set_report_scan_run_status (global_current_report, TASK_STATUS_RUNNING); - snprintf (title, sizeof (title), "gvmd: OSP: Handling scan %s", report_id); proctitle_set (title);