mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +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:
parent
fef3ba7f37
commit
aeae42ddc3
1 changed files with 8 additions and 5 deletions
13
nmap_dns.cc
13
nmap_dns.cc
|
|
@ -1345,12 +1345,15 @@ std::list<std::string> get_dns_servers() {
|
|||
if(servs.size() == 0 && firstrun) {
|
||||
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<std::string> serverList;
|
||||
dns_server *tpserv;
|
||||
for(servI = servs.begin(); servI != servs.end(); servI++) {
|
||||
tpserv = *servI;
|
||||
serverList.push_back(inet_ntoa(tpserv->addr.sin_addr));
|
||||
}
|
||||
for(servI = servs.begin(); servI != servs.end(); servI++)
|
||||
serverList.push_back(inet_ntoa((*servI)->addr.sin_addr));
|
||||
|
||||
return serverList;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue