Nmap Development mailing list archives

Re: [NSE] Undeclared variable in dns.processResponse()


From: Patrik Karlsson <patrik () cqure net>
Date: Fri, 29 Oct 2010 07:05:39 +0200


On 29 okt 2010, at 04.24, Ron wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,

While writing some sample code for the DNS library, I wrote the following code:
 local status, result = dns.query('www.obscuredomain.com', {norecurse=true})

It generates the following error:
./nselib/strict.lua:65: variable 'host' is not declared
stack traceback:
       [C]: in function 'error'
       ./nselib/strict.lua:69: in function <./nselib/strict.lua:60>
       ./nselib/strict.lua:65: in function <./nselib/strict.lua:60>
       ./nselib/dns.lua:198: in function <./nselib/dns.lua:175>

The line number's going to be wrong because I'm modifying dns.lua right now, but this is the line:

      -- only ask next server in authority, if 
      -- we got an auth dns and
      -- it isn't the one we just asked
      if next_server and next_server ~= host and options.tries > 1 then   -- <---------- THIS LINE
         options.host = next_server
         options.tries = option.tries - 1
         return query(dname, options)
      end

I don't know the code well enough to fix it myself with any confidence, but I'm guessing that 'host' simply needs to 
be changed to 'options.host'. 

Can somebody more familiar with the code confirm?

I introduced this bug when I factored out the code in order to better be able to process multiple responses when doing 
multicast DNS.
Looking at the code in r20446 we have the following at the top of the query function:

   local dtype, host, port, tries = options.dtype, options.host, options.port, options.tries

So, as far as I see it, your change should be correct. I've did the same change and commited it as r20831.


Thanks!

Ron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEARECAAYFAkzKMHQACgkQ2t2zxlt4g/SujACfSWzl70Ct9fNbbUO9HnEWGsSg
GJMAn2DhGuE7+mU37VpuHlHVzX8+mz/V
=BZsT
-----END PGP SIGNATURE-----
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


//Patrik

--
Patrik Karlsson
http://www.cqure.net
http://www.twitter.com/nevdull77





_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: