Fix a bug in dns.lua: ensure that dns.query() always return two values (status and response).

Update asn-query.nse accordingly.
This commit is contained in:
henri 2011-09-22 18:00:44 +00:00
parent feb691f534
commit b7df13296e
2 changed files with 4 additions and 4 deletions

View file

@ -370,7 +370,7 @@ local answerFetcher = {}
answerFetcher[types.TXT] = function(dec, retAll)
local answers = {}
if not retAll and dec.answers[1].data then
return string.sub(dec.answers[1].data, 2)
return true, string.sub(dec.answers[1].data, 2)
elseif not retAll then
stdnse.print_debug(1, "dns.answerFetcher found no records of the required type: TXT")
return false, "No Answers"
@ -599,7 +599,7 @@ local additionalFetcher = {}
additionalFetcher[types.TXT] = function(dec, retAll)
local answers = {}
if not retAll and dec.add[1].data then
return string.sub(dec.add[1].data, 2)
return true, string.sub(dec.add[1].data, 2)
elseif not retAll then
stdnse.print_debug(1, "dns.aditionalFetcher found no records of the required type: TXT")
return false, "No Answers"

View file

@ -287,8 +287,8 @@ function asn_description( asn )
-- send query
local query = ( "AS%s.asn.cymru.com" ):format( asn )
local decoded_response, other_response = dns.query( query, options)
if type( decoded_response ) ~= "string" then
local status, decoded_response = dns.query( query, options )
if not status then
return ""
end