summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-11-03 23:15:07 -0400
committerAdam <Adam@anope.org>2016-11-03 23:15:07 -0400
commitef32505633ad40bd3937edfa739f6b13ecdda599 (patch)
tree5535f8138c6d77a2a9f70ae7a060e56f6e78b4ec
parent304494322fa515f1d6dc294e333329ca4731bd29 (diff)
dns: set error to REFUSED when there are no answers
-rw-r--r--modules/commands/os_dns.cpp1
-rw-r--r--modules/m_dns.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp
index 687f44f4a..b3062fa3d 100644
--- a/modules/commands/os_dns.cpp
+++ b/modules/commands/os_dns.cpp
@@ -940,7 +940,6 @@ class ModuleDNS : public Module
if (packet->answers.size() == answer_size)
{
Log(this) << "Error! There are no servers with any IPs of type " << q.type;
- /* Send back an empty answer anyway */
}
}
}
diff --git a/modules/m_dns.cpp b/modules/m_dns.cpp
index 93f09246e..4dc6d7bfa 100644
--- a/modules/m_dns.cpp
+++ b/modules/m_dns.cpp
@@ -854,6 +854,9 @@ class MyManager : public Manager, public Timer
}
}
+ if (packet->answers.empty() && packet->authorities.empty() && packet->additional.empty() && packet->error == ERROR_NONE)
+ packet->error = ERROR_REFUSED; // usually safe, won't cause an NXDOMAIN to get cached
+
s->Reply(packet);
return true;
}