aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-01-13 07:17:32 +0000
committerGravatar Sadie Powell2023-01-13 07:23:45 +0000
commitb353b799a2288bfde132a1909f78f4e1cbd1fd28 (patch)
treef0430248fa53e1edda368da86538ab068dd4e7ae /src
parentMake Dependabot send pull requests to the insp3 branch. (diff)
Fix core_dns rejecting simple hostnames.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_dns.cpp2
-rw-r--r--src/helperfuncs.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index 9330c173f..55f3ea6a4 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -192,7 +192,7 @@ class Packet : public Query
case QUERY_PTR:
{
record.rdata = this->UnpackName(input, input_size, pos);
- if (!InspIRCd::IsHost(record.rdata))
+ if (!InspIRCd::IsHost2(record.rdata, true))
throw Exception("Invalid name"); // XXX: Causes the request to time out
break;
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index f2b023f81..0b5681d0e 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -273,7 +273,7 @@ bool InspIRCd::DefaultIsIdent(const std::string& n)
return true;
}
-bool InspIRCd::IsHost(const std::string& host)
+bool InspIRCd::IsHost2(const std::string& host, bool allowsimple)
{
// Hostnames must be non-empty and shorter than the maximum hostname length.
if (host.empty() || host.length() > ServerInstance->Config->Limits.MaxHost)
@@ -329,7 +329,7 @@ bool InspIRCd::IsHost(const std::string& host)
// Whilst simple hostnames (e.g. localhost) are valid we do not allow the server to use
// them to prevent issues with clients that differentiate between short client and server
// prefixes by checking whether the nickname contains a dot.
- return numdots;
+ return numdots || allowsimple;
}
bool InspIRCd::IsSID(const std::string &str)