Nmap Development mailing list archives

Re: [NSE] - dns.query() return types


From: David Fifield <david () bamsoftware com>
Date: Tue, 21 Jul 2009 21:25:29 -0600

On Mon, Jul 20, 2009 at 11:14:11PM +0100, jah wrote:
I've looked a little closer to the types of return values from
dns.query() and seen that there's room for some improvement.  Here's a
run-down of the conditions under which each type is returned:

In summary, the return values from dns.query() can be

1st return value: nil, false, string answer, table of 0 or more string
answers, table decoded response
2nd return value: nil, 3, 9, table decoded response

In order to improve the ease of use, I propose that query() should return:
false, error
true, answer
true, decoded_response

where:
answer is string or, if the caller sets options.retAll, a table of 1 or
more answer strings
error is one of something like: "No Such Name", "No Servers", "No
Answers", "Unable to handle response"
decoded_response is returned instead of answer when the caller sets
options.retPkt

So other than streamlining the variations in return values, we would now
never return the decoded_response if we don't have an 'answer fetcher'
for the response type - or for any other reason except when the caller
requests it instead of an answer.

This normalization is a good idea. You may commit it with the necessary
script changes.

What is the MX change that you mentioned?

David

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


Current thread: