From d397ac4076c8c76721d5ad94d14f72e22190950a Mon Sep 17 00:00:00 2001 From: patrik Date: Tue, 24 Jul 2012 18:41:42 +0000 Subject: [PATCH] Fixed bug that would result in the stun-version script incorrectly reporting the stun port as open when the stun service would not respond to the service probe and the port was reported as open|filtered. --- nselib/stun.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nselib/stun.lua b/nselib/stun.lua index ce03c2904..ce844f32f 100644 --- a/nselib/stun.lua +++ b/nselib/stun.lua @@ -352,6 +352,10 @@ Helper = { end end + if ( not(result) and not(self.cache) ) then + return false, "Server returned no response" + end + return status, result end, @@ -359,9 +363,14 @@ Helper = { -- @return status true on success, false on failure -- @return version string containing the server product and version getVersion = function(self) + local status, response = false, nil -- check if the server version was cached if ( not(self.cache) or not(self.cache.version) ) then - self:getExternalAddress() + local status, response = self:getExternalAddress() + if ( status ) then + return true, (self.cache and self.cache.server or "") + end + return false, response end return true, (self.cache and self.cache.server or "") end,