Nmap Development mailing list archives
NSE exceptions: false or nil?
From: David Fifield <david () bamsoftware com>
Date: Thu, 1 Nov 2007 22:40:22 -0700
Are NSE exceptions supposed to return false or nil? At http://insecure.org/nmap/nse/nse-api.html#nse-exceptions it says that the first thing returned is a Boolean value. But trying to catch an exception from connect fails, as the attached example script (test.nse) shows. It produces this message: Initiating SCRIPT ENGINE at 22:26 false Name or service not known SCRIPT ENGINE: In: nse_nmaplib.cc:474 Trying to finalize a non conforming function. Are you sure you return true on success followed by the remaining return values and nil on failure followed by an error string? QUITTING! We see that connect returns (false, "Name or service not known"), but this is "non conforming." Should NSE's internal functions be modified to return nil instead of false, or should false be considered an exception marker? Does the patch I attached do the right thing? David Fifield
Attachment:
test.nse
Description:
Attachment:
nse-exception.diff
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- NSE exceptions: false or nil? David Fifield (Nov 01)
- Re: NSE exceptions: false or nil? Stoiko Ivanov (Nov 02)
- Re: NSE exceptions: false or nil? David Fifield (Nov 03)
- Re: NSE exceptions: false or nil? Stoiko Ivanov (Nov 02)