Nmap Development mailing list archives

Re: [NSE][PATCH] only show script errors in verbose mode


From: David Fifield <david () bamsoftware com>
Date: Fri, 26 Sep 2008 20:54:57 -0600

On Fri, Sep 26, 2008 at 01:06:30PM -0600, Patrick Donnelly wrote:
On Fri, Sep 26, 2008 at 12:26 PM, David Fifield <david () bamsoftware com> wrote:
How about just creating a new C type, say nmap.error, each instance of
which would be associated with a certain metatable (so we could do
luaL_checkudata on it), and which would allow a custom string for each
instance. I was reading http://www.lua.org/pil/28.2.html and it appears
to be just what we need.

Well yes, we want a class of errors. As I showed earlier, we have each
userdata used as a unique key in the errors table. If, when we index a
userdata thrown by an error, we get nil, then it is _not_ one of our
module errors (it is just a different kind of error).

I attached a sample implementation, that just defines a simple
nmap.error type and a function nmap.quiet_error to raise one with a
custom string. Does this seems like a decent approach? It raises an
error that is handled like any other error (it doesn't just make the
portrule return false), except that it's not printed by default.

As good as this discussion has been, I've grown more uncertain about the
new error-handling routines that have been proposed, especially now that
I've tried to implement my own. I'm concerned that I'm inventing a
half-baked new exception handling mechanism here, and that there should
be a simpler way to handle this. I'd like to use a simple technique now,
and allow this discussion to continue so it can perhaps be replaced by
something better. I don't want this comparatively minor issue to hold up
the integration of the openssl module, which is now only waiting on any
possible API suggestions from Ron.

I think that for now we should just use pcall(require, "openssl") in the
script and make the portrule return false, because that's simple and
safe, and it can be replaced by something more sophisticated at any
time.

David Fifield

Attachment: openssl-require-error.diff
Description:


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

Current thread: