summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-06-29 11:29:08 +0100
committerPeter Powell <petpow@saberuk.com>2018-07-10 21:14:56 +0100
commit49b9c6bcb9746469c00619f6fe1d444326d42b60 (patch)
treef9b049aaee4bc20d0235c2df0b6cfed04d423a73 /src
parent32eb5386ba181e23fb5274a919a6fd7463805674 (diff)
Switch core_dns validation to use InspIRCd::IsHost.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_dns.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index ea234861a..4caea9c48 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -40,11 +40,6 @@ using namespace DNS;
*/
class Packet : public Query
{
- static bool IsValidName(const std::string& name)
- {
- return (name.find_first_not_of("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-") == std::string::npos);
- }
-
void PackName(unsigned char* output, unsigned short output_size, unsigned short& pos, const std::string& name)
{
if (pos + name.length() + 2 > output_size)
@@ -195,7 +190,7 @@ class Packet : public Query
case QUERY_PTR:
{
record.rdata = this->UnpackName(input, input_size, pos);
- if (!IsValidName(record.rdata))
+ if (!InspIRCd::IsHost(record.rdata))
throw Exception("Invalid name"); // XXX: Causes the request to time out
break;