mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Fall back to system resolution if we get NXDOMAIN and the name is non-ascii
This commit is contained in:
21
nmap_dns.cc
21
nmap_dns.cc
@@ -783,15 +783,31 @@ static void read_evt_handler(nsock_pool nsp, nsock_event evt, void *) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
info &reqinfo = infoI->second;
|
info &reqinfo = infoI->second;
|
||||||
|
DNS::Request *reqt = reqinfo.tpreq->targ;
|
||||||
|
bool processing_successful = false;
|
||||||
|
|
||||||
if (DNS_HAS_ERR(f, DNS::ERR_NAME) || p.answers.empty())
|
if (DNS_HAS_ERR(f, DNS::ERR_NAME) || p.answers.empty())
|
||||||
{
|
{
|
||||||
|
// Check if this was a nonstandard name;
|
||||||
|
if (reqt->type != DNS::PTR) {
|
||||||
|
for (std::string::const_iterator it=reqt->name.begin(); it < reqt->name.end(); it++) {
|
||||||
|
if (*it < '0') { // signed char comparison; non-ascii are < 0
|
||||||
|
// system resolver might be able to do better with things like AI_IDN
|
||||||
|
process_request(ACTION_SYSTEM_RESOLVE, reqinfo);
|
||||||
|
processing_successful = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!processing_successful) {
|
||||||
process_request(ACTION_FINISHED, reqinfo);
|
process_request(ACTION_FINISHED, reqinfo);
|
||||||
if (o.debugging >= TRACE_DEBUG_LEVEL)
|
if (o.debugging >= TRACE_DEBUG_LEVEL)
|
||||||
log_write(LOG_STDOUT, "mass_dns: NXDOMAIN <id = %d>\n", p.id);
|
log_write(LOG_STDOUT, "mass_dns: NXDOMAIN <id = %d>\n", p.id);
|
||||||
output_summary();
|
|
||||||
stat_nx++;
|
stat_nx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
output_summary();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -805,12 +821,9 @@ static void read_evt_handler(nsock_pool nsp, nsock_event evt, void *) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool processing_successful = false;
|
|
||||||
|
|
||||||
sockaddr_storage ip;
|
sockaddr_storage ip;
|
||||||
ip.ss_family = AF_UNSPEC;
|
ip.ss_family = AF_UNSPEC;
|
||||||
std::string alias;
|
std::string alias;
|
||||||
DNS::Request *reqt = reqinfo.tpreq->targ;
|
|
||||||
|
|
||||||
for(std::list<DNS::Answer>::const_iterator it = p.answers.begin();
|
for(std::list<DNS::Answer>::const_iterator it = p.answers.begin();
|
||||||
it != p.answers.end(); ++it )
|
it != p.answers.end(); ++it )
|
||||||
|
|||||||
Reference in New Issue
Block a user