mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Handle 'localhost' target name in mass_dns
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o Fixed an issue with the parallel forward DNS resolver: it had not been
|
||||
consulting /etc/hosts, nor did it correctly handle the 'localhost' name.
|
||||
|
||||
Nmap 7.96 [2025-05-01]
|
||||
|
||||
o Upgraded included libraries: OpenSSL 3.0.16, Lua 5.4.7, libssh2 1.11.1,
|
||||
|
||||
11
nmap_dns.cc
11
nmap_dns.cc
@@ -1088,6 +1088,17 @@ static void parse_etchosts(const char *fname) {
|
||||
sockaddr_storage ia;
|
||||
size_t ialen;
|
||||
|
||||
// First, load localhost names
|
||||
line = "localhost";
|
||||
if (0 == resolve_numeric("::1", 0, &ia, &ialen, AF_INET6)) {
|
||||
host_cache.add(ia, line);
|
||||
etchosts[NameRecord(line, DNS::AAAA)] = ia;
|
||||
}
|
||||
if (0 == resolve_numeric("127.0.0.1", 0, &ia, &ialen, AF_INET)) {
|
||||
host_cache.add(ia, line);
|
||||
etchosts[NameRecord(line, DNS::A)] = ia;
|
||||
}
|
||||
|
||||
if (ifs.fail()) return; // silently is OK
|
||||
|
||||
while (std::getline(ifs, line)) {
|
||||
|
||||
Reference in New Issue
Block a user