1
0
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:
dmiller
2025-05-09 22:47:08 +00:00
parent a7ca9aba7b
commit 79d468d7a1
2 changed files with 14 additions and 0 deletions

View File

@@ -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)) {