From 3ded2339e880d0c117a4942d3ab9548c784f7c2c Mon Sep 17 00:00:00 2001 From: ron Date: Mon, 13 Dec 2010 16:22:14 +0000 Subject: [PATCH] Fixed an issue in script dependencies that caused the later scripts to begin without waiting for the earlier scripts to finish. Patch written by Patrick Donneley. --- nse_main.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/nse_main.lua b/nse_main.lua index e08bb9a1b..4d3aa93f4 100644 --- a/nse_main.lua +++ b/nse_main.lua @@ -962,12 +962,11 @@ local function main (hosts, scantype) end); end - -- This iterator is passed to the run function. It returns one new script - -- thread on demand until exhausted. - local function threads_iter () - -- activate prerule scripts - for runlevel, scripts in ipairs(runlevels) do - print_verbose(1, "Starting runlevel %u (of %u) scan.", runlevel, #runlevels); + for runlevel, scripts in ipairs(runlevels) do + -- This iterator is passed to the run function. It returns one new script + -- thread on demand until exhausted. + local function threads_iter () + -- activate prerule scripts if (scantype == NSE_PRE_SCAN) then print_verbose(1, "Script Pre-scanning."); for script in runlevel_scripts(scripts) do @@ -1017,10 +1016,10 @@ local function main (hosts, scantype) end end end + print_verbose(1, "Starting runlevel %u (of %u) scan.", runlevel, #runlevels); + run(wrap(threads_iter), scantype) end - run(wrap(threads_iter), scantype) - collectgarbage "collect"; end