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?
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?
Sent through the nmap-dev mailing list
Archived at http://SecLists.Org
- NSE exceptions: false or nil? David Fifield (Nov 02)