From d4e1c958e27596af44db9be9046528f6d9116312 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 25 Dec 2012 01:09:03 -0500 Subject: [PATCH] packet->answers isnt always empty initially, like with axfrs --- modules/commands/os_dns.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp index cc1928b64..714203c59 100644 --- a/modules/commands/os_dns.cpp +++ b/modules/commands/os_dns.cpp @@ -765,6 +765,7 @@ class ModuleDNS : public Module return; DNSZone *zone = DNSZone::Find(q.name); + size_t answer_size = packet->answers.size(); if (zone) { for (std::set::iterator it = zone->servers.begin(), it_end = zone->servers.end(); it != it_end; ++it) @@ -788,7 +789,7 @@ class ModuleDNS : public Module } } - if (packet->answers.empty()) + if (packet->answers.size() == answer_size) { /* Default zone */ for (unsigned i = 0; i < dns_servers.size(); ++i) @@ -812,7 +813,7 @@ class ModuleDNS : public Module } } - if (packet->answers.empty()) + if (packet->answers.size() == answer_size) { static time_t last_warn = 0; if (last_warn + 60 < Anope::CurTime) @@ -840,7 +841,7 @@ class ModuleDNS : public Module } } - if (packet->answers.empty()) + if (packet->answers.size() == answer_size) { Log(this) << "Error! There are no servers with any IPs. At all."; /* Send back an empty answer anyway */