1
0
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:
dmiller
2025-05-09 22:47:05 +00:00
parent cec0cc6f99
commit cf2403e9d7

View File

@@ -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())
{ {
process_request(ACTION_FINISHED, reqinfo); // Check if this was a nonstandard name;
if (o.debugging >= TRACE_DEBUG_LEVEL) if (reqt->type != DNS::PTR) {
log_write(LOG_STDOUT, "mass_dns: NXDOMAIN <id = %d>\n", p.id); for (std::string::const_iterator it=reqt->name.begin(); it < reqt->name.end(); it++) {
output_summary(); if (*it < '0') { // signed char comparison; non-ascii are < 0
stat_nx++; // 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);
if (o.debugging >= TRACE_DEBUG_LEVEL)
log_write(LOG_STDOUT, "mass_dns: NXDOMAIN <id = %d>\n", p.id);
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 )