From bf2acde23263232648eb6f261db797eebbe35960 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 26 Apr 2024 17:25:41 +0000 Subject: [PATCH] Handle chained CNAME records --- nmap_dns.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nmap_dns.cc b/nmap_dns.cc index 348876863..ec92ef414 100644 --- a/nmap_dns.cc +++ b/nmap_dns.cc @@ -762,7 +762,7 @@ static void read_evt_handler(nsock_pool nsp, nsock_event evt, void *) { else if (a.record_type == DNS::CNAME) { const DNS::CNAME_Record *cname = static_cast(a.record); if((reqt->type == DNS::PTR && DNS::Factory::ptrToIp(a.name, ip)) - || a.name == reqt->name) + || a.name == reqt->name || (!alias.empty() && a.name == alias)) { alias = cname->value; if (o.debugging >= TRACE_DEBUG_LEVEL) @@ -782,7 +782,7 @@ static void read_evt_handler(nsock_pool nsp, nsock_event evt, void *) { else if (!alias.empty()) { if (o.debugging >= TRACE_DEBUG_LEVEL) { - log_write(LOG_STDOUT, "mass_dns: CNAME for <%s> not processed.\n", reqinfo.tpreq->targ->repr()); + log_write(LOG_STDOUT, "mass_dns: CNAME for <%s> not processed.\n", reqt->repr()); } // TODO: Send a PTR request for alias instead. Meanwhile, we'll just fall // back to using system resolver. Alternative: report the canonical name @@ -791,7 +791,7 @@ static void read_evt_handler(nsock_pool nsp, nsock_event evt, void *) { } else { if (o.debugging >= TRACE_DEBUG_LEVEL) { - log_write(LOG_STDOUT, "mass_dns: Unable to process the response\n"); + log_write(LOG_STDOUT, "mass_dns: Unable to process the response for %s\n", reqt->repr()); } } }