mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Add an assertion that l_get_dns_servers doesn't return any DNS servers is
!o.mass_dns. Simplify the loop that builds the server list.
This commit is contained in:
13
nmap_dns.cc
13
nmap_dns.cc
@@ -1345,12 +1345,15 @@ std::list<std::string> get_dns_servers() {
|
|||||||
if(servs.size() == 0 && firstrun) {
|
if(servs.size() == 0 && firstrun) {
|
||||||
nmap_mass_rdns(NULL, 0);
|
nmap_mass_rdns(NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the user said --system-dns (!o.mass_dns), we should never return a list
|
||||||
|
// of servers.
|
||||||
|
assert(o.mass_dns || servs.empty());
|
||||||
|
|
||||||
std::list<dns_server *>::iterator servI;
|
std::list<dns_server *>::iterator servI;
|
||||||
std::list<std::string> serverList;
|
std::list<std::string> serverList;
|
||||||
dns_server *tpserv;
|
for(servI = servs.begin(); servI != servs.end(); servI++)
|
||||||
for(servI = servs.begin(); servI != servs.end(); servI++) {
|
serverList.push_back(inet_ntoa((*servI)->addr.sin_addr));
|
||||||
tpserv = *servI;
|
|
||||||
serverList.push_back(inet_ntoa(tpserv->addr.sin_addr));
|
|
||||||
}
|
|
||||||
return serverList;
|
return serverList;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user