summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2014-03-06 21:43:36 +0000
committerAttila Molnar <attilamolnar@hush.com>2014-03-08 13:01:09 +0100
commitf2db4b743f0df9b9e588979fd0fcf2815e54af44 (patch)
treeaaef011a92d187cb1e7a81355de18e2f58d8815e /src/modules
parent9ccb36800a6512d9aaa0b429eca0b94d7caa0d33 (diff)
Make the maximum hostname length configurable in the config.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_cgiirc.cpp6
-rw-r--r--src/modules/m_chghost.cpp2
-rw-r--r--src/modules/m_sethost.cpp2
-rw-r--r--src/modules/m_spanningtree/capab.cpp1
-rw-r--r--src/modules/m_spanningtree/utils.cpp4
5 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index a6f798b24..e95b838a2 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -89,7 +89,7 @@ class CommandWebirc : public Command
realhost.set(user, user->host);
realip.set(user, user->GetIPString());
- bool host_ok = (parameters[2].length() < 64);
+ bool host_ok = (parameters[2].length() <= ServerInstance->Config->Limits.MaxHost);
const std::string& newhost = (host_ok ? parameters[2] : parameters[3]);
if (notify)
@@ -140,7 +140,7 @@ class CGIResolver : public DNS::Request
return;
const DNS::ResourceRecord &ans_record = r->answers[0];
- if (ans_record.rdata.empty() || ans_record.rdata.length() > 64)
+ if (ans_record.rdata.empty() || ans_record.rdata.length() > ServerInstance->Config->Limits.MaxHost)
return;
if (notify)
@@ -394,7 +394,7 @@ public:
bool IsValidHost(const std::string &host)
{
- if(!host.size() || host.size() > 64)
+ if(!host.size() || host.size() > ServerInstance->Config->Limits.MaxHost)
return false;
for(unsigned int i = 0; i < host.size(); i++)
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index eefac00f1..3a637f9d0 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -39,7 +39,7 @@ class CommandChghost : public Command
{
const char* x = parameters[1].c_str();
- if (parameters[1].length() > 63)
+ if (parameters[1].length() > ServerInstance->Config->Limits.MaxHost)
{
user->WriteNotice("*** CHGHOST: Host too long");
return CMD_FAILURE;
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index ee0fc01e4..75dbe1c6a 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -46,7 +46,7 @@ class CommandSethost : public Command
}
}
- if (len > 64)
+ if (len > ServerInstance->Config->Limits.MaxHost)
{
user->WriteNotice("*** SETHOST: Host too long");
return CMD_FAILURE;
diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp
index dc48c87df..6542a1f3a 100644
--- a/src/modules/m_spanningtree/capab.cpp
+++ b/src/modules/m_spanningtree/capab.cpp
@@ -149,6 +149,7 @@ void TreeSocket::SendCapabilities(int phase)
" MAXKICK="+ConvToStr(ServerInstance->Config->Limits.MaxKick)+
" MAXGECOS="+ConvToStr(ServerInstance->Config->Limits.MaxGecos)+
" MAXAWAY="+ConvToStr(ServerInstance->Config->Limits.MaxAway)+
+ " MAXHOST="+ConvToStr(ServerInstance->Config->Limits.MaxHost)+
extra+
" PREFIX="+ServerInstance->Modes->BuildPrefixes()+
" CHANMODES="+ServerInstance->Modes->GiveModeList(MODETYPE_CHANNEL)+
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index de96b073d..263a5db1e 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -301,8 +301,8 @@ void SpanningTreeUtilities::ReadConfiguration()
if (L->Name.find('.') == std::string::npos)
throw ModuleException("The link name '"+assign(L->Name)+"' is invalid as it must contain at least one '.' character");
- if (L->Name.length() > 64)
- throw ModuleException("The link name '"+assign(L->Name)+"' is invalid as it is longer than 64 characters");
+ if (L->Name.length() > ServerInstance->Config->Limits.MaxHost)
+ throw ModuleException("The link name '"+assign(L->Name)+"' is invalid as it is longer than " + ConvToStr(ServerInstance->Config->Limits.MaxHost) + " characters");
if (L->RecvPass.empty())
throw ModuleException("Invalid configuration for server '"+assign(L->Name)+"', recvpass not defined");