1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-04 21:59:02 +00:00

Don't crash when an NSE library (e.g. sasl) calls stdnse.debug during require

This commit is contained in:
dmiller
2015-01-01 21:09:03 +00:00
parent 2f02fa2935
commit d1e429f42b

View File

@@ -68,6 +68,12 @@ _ENV = require "strict" {};
-- @usage stdnse.sleep(1.5)
_ENV.sleep = nmap.socket.sleep;
-- These stub functions get overwritten by the script run loop in nse_main.lua
-- These empty stubs will be used if a library calls stdnse.debug while loading
_ENV.getid = function () return end
_ENV.getinfo = function () return end
_ENV.gethostport = function () return end
local function debug (level, ...)
if type(level) ~= "number" then
return debug(1, level, ...)