From 4a5bdd4a13e5e2370eb206cf625eaf723d7cc4f7 Mon Sep 17 00:00:00 2001 From: batrick Date: Sun, 17 May 2009 19:48:46 +0000 Subject: [PATCH] A warning is printed when a script in the script database cannot be located using nmap_fetchfile. Nmap no longer exits due to this error. --- nse_main.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/nse_main.lua b/nse_main.lua index 953d38968..33832acf3 100644 --- a/nse_main.lua +++ b/nse_main.lua @@ -340,13 +340,18 @@ local function get_chosen_scripts (rules) for globalized_rule, rule_table in pairs(entry_rules) do if setfenv(rule_table.compiled_rule, env)() then -- run the compiled rule - local t, path = cnse.fetchfile_absolute(filename); - assert(t == "file", filename.." is not a file!"); - if not files_loaded[path] then - chosen_scripts[#chosen_scripts+1] = Script.new(path); - files_loaded[path] = true; - end used_rules[rule_table.original_rule] = true; + local t, path = cnse.fetchfile_absolute(filename); + if t == "file" then + if not files_loaded[path] then + chosen_scripts[#chosen_scripts+1] = Script.new(path); + files_loaded[path] = true; + -- do not break so other rules can be marked as used + end + else + log_error("Warning: Could not load '%s': %s", filename, path); + break; + end end end end