From f660381733c6bca7b75dfcfdc6b4e27fefdaeb41 Mon Sep 17 00:00:00 2001 From: Timo Pollmeier Date: Mon, 4 Mar 2024 13:52:42 +0100 Subject: [PATCH] Fix: Apply exclude_hosts of target in CVE scans CVE scans now exclude IP addresses specified in the exclude_hosts of the task target. This makes the behavior consistent with normal OpenVAS scans. --- src/manage.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/manage.c b/src/manage.c index e0ef3bb4b..d3d95483a 100644 --- a/src/manage.c +++ b/src/manage.c @@ -3167,7 +3167,7 @@ static int fork_cve_scan_handler (task_t task, target_t target) { int pid; - char *report_id, *hosts; + char *report_id, *hosts, *exclude_hosts; gvm_hosts_t *gvm_hosts; gvm_host_t *gvm_host; @@ -3234,6 +3234,8 @@ fork_cve_scan_handler (task_t task, target_t target) exit (1); } + exclude_hosts = target_exclude_hosts (target); + reset_task (task); set_task_start_time_epoch (task, time (NULL)); set_scan_start_time_epoch (global_current_report, time (NULL)); @@ -3241,7 +3243,11 @@ fork_cve_scan_handler (task_t task, target_t target) /* Add the results. */ gvm_hosts = gvm_hosts_new (hosts); + gvm_hosts_exclude (gvm_hosts, exclude_hosts ?: ""); + free (hosts); + free (exclude_hosts); + while ((gvm_host = gvm_hosts_next (gvm_hosts))) if (cve_scan_host (task, global_current_report, gvm_host)) {