Nmap Development mailing list archives
Re: [NSE] nmap library problems
From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Tue, 30 Dec 2008 00:15:38 -0700
On Mon, Dec 29, 2008 at 11:06 PM, David Fifield <david () bamsoftware com> wrote:
On Mon, Dec 29, 2008 at 03:25:49PM -0700, Patrick Donnelly wrote:I changed it to print an error message if the first value is not a boolean. Having the script cause Nmap to exit is too strict in my opinion.You're right, aborting the script rather than killing Nmap is better.
Right now it isn't aborting the script just using Nmap's error function that prints the error message but allows script (program) execution to continue (it casts the first value to a boolean). Perhaps it should raise an error on the script too?
Just checking that the first argument is a boolean is not quite right, because lots of library functions raise an exception by returning nil not false. The logic should be nil or false: indicates an exception. true: indicates success. anything else: "finalizing a non-conforming function". At least until we enforce a standard on returning false or nil (if we ever do).
Actually nil should be acceptable too, I will change that. nil, "error message" is very common although it isn't really intended for our try/catch handlers but for Lua's assert function.
Good work on this. Anyone's who has worked in nse_nmaplib.cc will appreciate the improvements. (If you haven't you'll have to take my word for it.) Especially the set_port_state/set_port_version functions are a lot better.
Thanks! -- -Patrick Donnelly "One of the lessons of history is that nothing is often a good thing to do and always a clever thing to say." -Will Durant _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [NSE] nmap library problems Patrick Donnelly (Dec 11)
- Re: [NSE] nmap library problems Patrick Donnelly (Dec 12)
- Re: [NSE] nmap library problems David Fifield (Dec 12)
- Re: [NSE] nmap library problems Patrick Donnelly (Dec 12)
- Re: [NSE] nmap library problems David Fifield (Dec 12)
- Re: [NSE] nmap library problems Patrick Donnelly (Dec 13)
- Re: [NSE] nmap library problems David Fifield (Dec 28)
- Re: [NSE] nmap library problems Patrick Donnelly (Dec 29)
- Re: [NSE] nmap library problems David Fifield (Dec 29)
- Re: [NSE] nmap library problems Patrick Donnelly (Dec 29)
- Re: [NSE] nmap library problems Patrick Donnelly (Dec 29)
- Re: [NSE] nmap library problems Patrick Donnelly (Dec 12)