Nmap Development mailing list archives
Re: [NSE] Undeclared variable in dns.processResponse()
From: Ron <ron () skullsecurity net>
Date: Fri, 29 Oct 2010 08:02:26 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, 29 Oct 2010 07:05:39 +0200 Patrik Karlsson <patrik () cqure net> wrote:
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.
Cool, thanks! After doing the fix, I noticed another error - a couple variables were misspelled. After fixing that (r20843), a more obscure error popped up that I haven't had any luck tracking down: NSE: test threw an error! [string "local connect, socket_lock = ...;..."]:4: bad argument #2 to 'connect' (string expected, got boolean) stack traceback: [C]: in function 'connect' [string "local connect, socket_lock = ...;..."]:4: in function 'connect' ./nselib/dns.lua:53: in function 'sendPackets' ./nselib/dns.lua:252: in function <./nselib/dns.lua:215> (tail call): ? (tail call): ? (tail call): ? (tail call): ? ././test.nse:41: in function <././test.nse:15> (tail call): ? Ron -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEARECAAYFAkzKxeUACgkQ2t2zxlt4g/TUYQCfeWg5eEFaL3RgPalnmRFzBDjb pqcAoIUKX9MueHIM4PvM/H2UaDC/pNbv =5mI7 -----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/
Current thread:
- [NSE] Undeclared variable in dns.processResponse() Ron (Oct 28)
- Re: [NSE] Undeclared variable in dns.processResponse() Patrik Karlsson (Oct 28)
- Re: [NSE] Undeclared variable in dns.processResponse() Ron (Oct 29)
- Re: [NSE] Undeclared variable in dns.processResponse() Patrik Karlsson (Oct 29)
- Re: [NSE] Undeclared variable in dns.processResponse() Ron (Oct 29)
- Re: [NSE] Undeclared variable in dns.processResponse() Patrik Karlsson (Oct 29)
- Re: [NSE] Undeclared variable in dns.processResponse() Ron (Oct 29)
- Re: [NSE] Undeclared variable in dns.processResponse() Patrik Karlsson (Oct 29)
- Re: [NSE] Undeclared variable in dns.processResponse() Ron (Oct 29)
- Re: [NSE] Undeclared variable in dns.processResponse() Ron (Oct 29)
- Re: [NSE] Undeclared variable in dns.processResponse() Patrik Karlsson (Oct 28)