summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_banredirect.cpp2
-rw-r--r--src/modules/m_chanprotect.cpp2
-rw-r--r--src/modules/m_chgident.cpp2
-rw-r--r--src/modules/m_chgname.cpp2
-rw-r--r--src/modules/m_conn_join.cpp2
-rw-r--r--src/modules/m_denychans.cpp4
-rw-r--r--src/modules/m_ident.cpp20
-rw-r--r--src/modules/m_nicklock.cpp10
-rw-r--r--src/modules/m_operjoin.cpp4
-rw-r--r--src/modules/m_redirect.cpp4
-rw-r--r--src/modules/m_sajoin.cpp4
-rw-r--r--src/modules/m_sanick.cpp10
-rw-r--r--src/modules/m_setident.cpp2
-rw-r--r--src/modules/m_setname.cpp2
-rw-r--r--src/modules/m_spanningtree/capab.cpp40
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp2
-rw-r--r--src/modules/m_spanningtree/ftopic.cpp2
-rw-r--r--src/modules/m_spanningtree/netburst.cpp24
-rw-r--r--src/modules/m_spanningtree/opertype.cpp4
-rw-r--r--src/modules/m_spanningtree/svsjoin.cpp3
-rw-r--r--src/modules/m_spanningtree/svspart.cpp3
-rw-r--r--src/modules/m_spanningtree/uid.cpp19
-rw-r--r--src/modules/m_svshold.cpp6
-rw-r--r--src/modules/m_watch.cpp4
24 files changed, 73 insertions, 104 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index a8add0c72..f786d48ee 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -114,7 +114,7 @@ class BanRedirect : public ModeWatcher
if(mask[CHAN].length())
{
- if(Srv->IsChannel(mask[CHAN].c_str()))
+ if(!IS_LOCAL(source) || Srv->IsChannel(mask[CHAN].c_str(), ServerInstance->Config->Limits.ChanMax))
{
if (assign(channel->name) == mask[CHAN])
{
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index e44e496f8..a79eda993 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -68,7 +68,7 @@ class FounderProtectBase
std::string item = extend + std::string(channel->name);
std::vector<std::string> mode_junk;
mode_junk.push_back(channel->name);
- irc::modestacker modestack(false);
+ irc::modestacker modestack(ServerInstance, false);
std::deque<std::string> stackresult;
for (CUList::iterator i = cl->begin(); i != cl->end(); i++)
diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index d0d77f193..3ab558b57 100644
--- a/src/modules/m_chgident.cpp
+++ b/src/modules/m_chgident.cpp
@@ -43,7 +43,7 @@ class CommandChgident : public Command
return CMD_FAILURE;
}
- if (parameters[1].length() > IDENTMAX - 1)
+ if (parameters[1].length() > ServerInstance->Config->Limits.IdentMax)
{
user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick.c_str());
return CMD_FAILURE;
diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp
index 233bb15b6..936cd72ac 100644
--- a/src/modules/m_chgname.cpp
+++ b/src/modules/m_chgname.cpp
@@ -43,7 +43,7 @@ class CommandChgname : public Command
return CMD_FAILURE;
}
- if (parameters[1].length() > MAXGECOS)
+ if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos)
{
user->WriteServ("NOTICE %s :*** GECOS too long", user->nick.c_str());
return CMD_FAILURE;
diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp
index 139414155..046176b0c 100644
--- a/src/modules/m_conn_join.cpp
+++ b/src/modules/m_conn_join.cpp
@@ -81,7 +81,7 @@ class ModuleConnJoin : public Module
return;
for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++)
- if (ServerInstance->IsChannel(it->c_str()))
+ if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time());
}
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index f28547679..e847f8c7c 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -45,7 +45,7 @@ class ModuleDenyChannels : public Module
if (!redirect.empty())
{
- if (!ServerInstance->IsChannel(redirect.c_str()))
+ if (!ServerInstance->IsChannel(redirect.c_str(), ServerInstance->Config->Limits.ChanMax))
{
if (user)
user->WriteServ("Notice %s :Invalid badchan redirect '%s'", user->nick.c_str(), redirect.c_str());
@@ -110,7 +110,7 @@ class ModuleDenyChannels : public Module
}
}
- if (ServerInstance->IsChannel(redirect.c_str()))
+ if (ServerInstance->IsChannel(redirect.c_str(), ServerInstance->Config->Limits.ChanMax))
{
/* simple way to avoid potential loops: don't redirect to +L channels */
Channel *newchan = ServerInstance->FindChan(redirect);
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index e7d8728d6..197a6e5e2 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -296,11 +296,11 @@ class IdentRequestSocket : public EventHandler
if (i < 3)
continue;
- char ident[IDENTMAX + 2];
+ std::string ident;
/* Truncate the ident at any characters we don't like, skip leading spaces */
- int k = 0;
- for (const char *j = token.c_str(); *j && (k < IDENTMAX + 1); j++)
+ size_t k = 0;
+ for (const char *j = token.c_str(); *j && (k < ServerInstance->Config->Limits.IdentMax + 1); j++)
{
if (*j == ' ')
continue;
@@ -308,17 +308,15 @@ class IdentRequestSocket : public EventHandler
/* Rules taken from InspIRCd::IsIdent */
if (((*j >= 'A') && (*j <= '}')) || ((*j >= '0') && (*j <= '9')) || (*j == '-') || (*j == '.'))
{
- ident[k++] = *j;
+ ident += *j;
continue;
}
break;
}
- ident[k] = '\0';
-
/* Re-check with IsIdent, in case that changes and this doesn't (paranoia!) */
- if (*ident && ServerInstance->IsIdent(ident))
+ if (!ident.empty() && ServerInstance->IsIdent(ident.c_str()))
{
result = ident;
}
@@ -366,9 +364,9 @@ class ModuleIdent : public Module
virtual int OnUserRegister(User *user)
{
/* User::ident is currently the username field from USER; with m_ident loaded, that
- * should be preceded by a ~. The field is actually IDENTMAX+2 characters wide. */
- if (user->ident.length() > IDENTMAX + 1)
- user->ident.assign(user->ident, 0, IDENTMAX);
+ * should be preceded by a ~. The field is actually IdentMax+2 characters wide. */
+ if (user->ident.length() > ServerInstance->Config->Limits.IdentMax + 1)
+ user->ident.assign(user->ident, 0, ServerInstance->Config->Limits.IdentMax);
user->ident.insert(0, "~");
user->WriteServ("NOTICE Auth :*** Looking up your ident...");
@@ -457,7 +455,7 @@ class ModuleIdent : public Module
user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", isock->GetResult());
/* Copy the ident string to the user */
- user->ident.assign(isock->GetResult(), 0, IDENTMAX+1);
+ user->ident.assign(isock->GetResult(), 0, ServerInstance->Config->Limits.IdentMax + 1);
/* The user isnt actually disconnecting, we call this to clean up the user */
OnUserDisconnect(user);
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index adeab2691..86054ab3e 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -48,7 +48,7 @@ class CommandNicklock : public Command
}
// check nick is valid
- if (!ServerInstance->IsNick(parameters[1].c_str()))
+ if (IS_LOCAL(user) && !ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
{
return CMD_FAILURE;
}
@@ -58,8 +58,12 @@ class CommandNicklock : public Command
if (!target->ForceNickChange(parameters[1].c_str()))
{
- // ugh, nickchange failed for some reason -- possibly existing nick? XXX change to UID here
- ServerInstance->Users->QuitUser(target, "Nickname collision");
+ // ugh, nickchange failed for some reason -- possibly existing nick?
+ if (!target->ForceNickChange(target->uuid.c_str()))
+ {
+ // Well shit, we cant even change them to their UID (this should not happen!)
+ ServerInstance->Users->QuitUser(target, "Nickname collision");
+ }
}
// give them a lock flag
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index 42415faa2..b0976b1cc 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -91,7 +91,7 @@ class ModuleOperjoin : public Module
return;
for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++)
- if (ServerInstance->IsChannel(it->c_str()))
+ if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
Channel::JoinUser(ServerInstance, user, it->c_str(), override, "", false, ServerInstance->Time());
std::map<std::string, std::vector<std::string> >::iterator i = operTypeChans.find(user->oper);
@@ -101,7 +101,7 @@ class ModuleOperjoin : public Module
const std::vector<std::string>& list = i->second;
for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
{
- if (ServerInstance->IsChannel(it->c_str()))
+ if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
{
Channel::JoinUser(ServerInstance, user, it->c_str(), override, "", false, ServerInstance->Time());
}
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 289a73dca..9c529a37d 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -42,9 +42,9 @@ class Redirect : public ModeHandler
{
Channel* c = NULL;
- if (!ServerInstance->IsChannel(parameter.c_str()))
+ if (IS_LOCAL(source) && !ServerInstance->IsChannel(parameter.c_str(), ServerInstance->Config->Limits.ChanMax))
{
- source->WriteNumeric(403, "%s %s :Invalid channel name",source->nick.c_str(), parameter.c_str());
+ source->WriteNumeric(403, "%s %s :Invalid channel name", source->nick.c_str(), parameter.c_str());
parameter.clear();
return MODEACTION_DENY;
}
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 8b237674b..5be61fbf6 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -37,10 +37,10 @@ class CommandSajoin : public Command
user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
return CMD_FAILURE;
}
- if (!ServerInstance->IsChannel(parameters[1].c_str()))
+ if (IS_LOCAL(source) && !ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax))
{
/* we didn't need to check this for each character ;) */
- user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name or name too long");
return CMD_FAILURE;
}
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index cd93377c8..83d7fabd4 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -38,7 +38,11 @@ class CommandSanick : public Command
return CMD_FAILURE;
}
std::string oldnick = user->nick;
- if (ServerInstance->IsNick(parameters[1].c_str()))
+ if (IS_LOCAL(user) && !ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
+ {
+ user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str());
+ }
+ else
{
if (target->ForceNickChange(parameters[1].c_str()))
{
@@ -52,10 +56,6 @@ class CommandSanick : public Command
return CMD_FAILURE;
}
}
- else
- {
- user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str());
- }
return CMD_FAILURE;
}
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index 13f5d0c92..6577ebbb3 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -35,7 +35,7 @@ class CommandSetident : public Command
return CMD_FAILURE;
}
- if (parameters[0].size() > IDENTMAX)
+ if (parameters[0].size() > ServerInstance->Config->Limits.IdentMax)
{
user->WriteServ("NOTICE %s :*** SETIDENT: Ident is too long", user->nick.c_str());
return CMD_FAILURE;
diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp
index eab376cab..8c35c2be2 100644
--- a/src/modules/m_setname.cpp
+++ b/src/modules/m_setname.cpp
@@ -35,7 +35,7 @@ class CommandSetname : public Command
return CMD_FAILURE;
}
- if (parameters[0].size() > MAXGECOS)
+ if (parameters[0].size() > ServerInstance->Config->Limits.MaxGecos)
{
user->WriteServ("NOTICE %s :*** SETNAME: GECOS too long", user->nick.c_str());
return CMD_FAILURE;
diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp
index 5919c65bb..9a45b8131 100644
--- a/src/modules/m_spanningtree/capab.cpp
+++ b/src/modules/m_spanningtree/capab.cpp
@@ -81,16 +81,16 @@ void TreeSocket::SendCapabilities()
}
this->WriteLine("CAPAB CAPABILITIES " /* Preprocessor does this one. */
- ":NICKMAX="+ConvToStr(NICKMAX)+
- " HALFOP="+ConvToStr(this->Instance->Config->AllowHalfop)+
- " CHANMAX="+ConvToStr(CHANMAX)+
- " MAXMODES="+ConvToStr(MAXMODES)+
- " IDENTMAX="+ConvToStr(IDENTMAX)+
- " MAXQUIT="+ConvToStr(MAXQUIT)+
- " MAXTOPIC="+ConvToStr(MAXTOPIC)+
- " MAXKICK="+ConvToStr(MAXKICK)+
- " MAXGECOS="+ConvToStr(MAXGECOS)+
- " MAXAWAY="+ConvToStr(MAXAWAY)+
+ ":NICKMAX="+ConvToStr(Instance->Config->Limits.NickMax)+
+ " HALFOP="+ConvToStr(Instance->Config->AllowHalfop)+
+ " CHANMAX="+ConvToStr(Instance->Config->Limits.ChanMax)+
+ " MAXMODES="+ConvToStr(Instance->Config->Limits.MaxModes)+
+ " IDENTMAX="+ConvToStr(Instance->Config->Limits.IdentMax)+
+ " MAXQUIT="+ConvToStr(Instance->Config->Limits.MaxQuit)+
+ " MAXTOPIC="+ConvToStr(Instance->Config->Limits.MaxTopic)+
+ " MAXKICK="+ConvToStr(Instance->Config->Limits.MaxKick)+
+ " MAXGECOS="+ConvToStr(Instance->Config->Limits.MaxGecos)+
+ " MAXAWAY="+ConvToStr(Instance->Config->Limits.MaxAway)+
" IP6NATIVE="+ConvToStr(ip6)+
" IP6SUPPORT="+ConvToStr(ip6support)+
" PROTOCOL="+ConvToStr(ProtocolVersion)+extra+
@@ -171,19 +171,6 @@ bool TreeSocket::Capab(const std::deque<std::string> &params)
reason = "Modules loaded on these servers are not correctly matched, these modules are not loaded on " + diff;
}
- cap_validation valid_capab[] = {
- {"Maximum nickname lengths differ or remote nickname length not specified", "NICKMAX", NICKMAX},
- {"Maximum ident lengths differ or remote ident length not specified", "IDENTMAX", IDENTMAX},
- {"Maximum channel lengths differ or remote channel length not specified", "CHANMAX", CHANMAX},
- {"Maximum modes per line differ or remote modes per line not specified", "MAXMODES", MAXMODES},
- {"Maximum quit lengths differ or remote quit length not specified", "MAXQUIT", MAXQUIT},
- {"Maximum topic lengths differ or remote topic length not specified", "MAXTOPIC", MAXTOPIC},
- {"Maximum kick lengths differ or remote kick length not specified", "MAXKICK", MAXKICK},
- {"Maximum GECOS (fullname) lengths differ or remote GECOS length not specified", "MAXGECOS", MAXGECOS},
- {"Maximum awaymessage lengths differ or remote awaymessage length not specified", "MAXAWAY", MAXAWAY},
- {"", "", 0}
- };
-
if (((this->CapKeys.find("IP6SUPPORT") == this->CapKeys.end()) && (ip6support)) || ((this->CapKeys.find("IP6SUPPORT") != this->CapKeys.end()) && (this->CapKeys.find("IP6SUPPORT")->second != ConvToStr(ip6support))))
reason = "We don't both support linking to IPV6 servers";
if (((this->CapKeys.find("IP6NATIVE") != this->CapKeys.end()) && (this->CapKeys.find("IP6NATIVE")->second == "1")) && (!ip6support))
@@ -201,13 +188,6 @@ bool TreeSocket::Capab(const std::deque<std::string> &params)
if (((this->CapKeys.find("HALFOP") == this->CapKeys.end()) && (Instance->Config->AllowHalfop)) || ((this->CapKeys.find("HALFOP") != this->CapKeys.end()) && (this->CapKeys.find("HALFOP")->second != ConvToStr(Instance->Config->AllowHalfop))))
reason = "We don't both have halfop support enabled/disabled identically";
-
- for (int x = 0; valid_capab[x].size; ++x)
- {
- if (((this->CapKeys.find(valid_capab[x].key) == this->CapKeys.end()) || ((this->CapKeys.find(valid_capab[x].key) != this->CapKeys.end()) &&
- (this->CapKeys.find(valid_capab[x].key)->second != ConvToStr(valid_capab[x].size)))))
- reason = valid_capab[x].reason;
- }
/* Challenge response, store their challenge for our password */
std::map<std::string,std::string>::iterator n = this->CapKeys.find("CHALLENGE");
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index 985c86143..4ef8d2d4f 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -60,7 +60,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
if (params.size() < 3)
return true;
- irc::modestacker modestack(true); /* Modes to apply from the users in the user list */
+ irc::modestacker modestack(Instance, true); /* Modes to apply from the users in the user list */
User* who = NULL; /* User we are currently checking */
std::string channel = params[0]; /* Channel name, as a string */
time_t TS = atoi(params[1].c_str()); /* Timestamp given to us for remote side */
diff --git a/src/modules/m_spanningtree/ftopic.cpp b/src/modules/m_spanningtree/ftopic.cpp
index 3ea775112..e18187087 100644
--- a/src/modules/m_spanningtree/ftopic.cpp
+++ b/src/modules/m_spanningtree/ftopic.cpp
@@ -34,7 +34,7 @@ bool TreeSocket::ForceTopic(const std::string &source, std::deque<std::string> &
if ((ts >= c->topicset) || (c->topic.empty()))
{
std::string oldtopic = c->topic;
- c->topic.assign(params[3], 0, MAXTOPIC);
+ c->topic.assign(params[3], 0, Instance->Config->Limits.MaxTopic);
c->setby.assign(params[2], 0, 127);
c->topicset = ts;
/* if the topic text is the same as the current topic,
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index 8444bbec6..793a3cf9a 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -96,8 +96,19 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
+ size_t ptrlen = 0;
+ std::string modestr = this->Instance->Modes->ModeString(i->first, c, false);
+
+ if ((curlen + modestr.length() + i->first->uuid.length() + 4) > 480)
+ {
+ buffer.append(list).append("\r\n");
+ dlen = curlen = snprintf(list, MAXBUF, ":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true));
+ ptr = list + dlen;
+ numusers = 0;
+ }
+
// The first parameter gets a : before it
- size_t ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", this->Instance->Modes->ModeString(i->first, c, false).c_str(), i->first->uuid.c_str());
+ ptrlen = snprintf(ptr, MAXBUF, " %s%s,%s", !numusers ? ":" : "", modestr.c_str(), i->first->uuid.c_str());
looped_once = true;
@@ -105,15 +116,6 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
ptr += ptrlen;
numusers++;
-
- if (curlen > (480-NICKMAX))
- {
- buffer.append(list).append("\r\n");
- dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true));
- ptr = list + dlen;
- ptrlen = 0;
- numusers = 0;
- }
}
// Okay, permanent channels will (of course) need this \r\n anyway, numusers check is if there
@@ -132,7 +134,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
params.append(" ").append(b->data);
linesize += size;
}
- if ((params.length() >= MAXMODES) || (currsize > 350))
+ if ((params.length() >= Instance->Config->Limits.MaxModes) || (currsize > 350))
{
/* Wrap at MAXMODES */
buffer.append(":").append(this->Instance->Config->GetSID()).append(" FMODE ").append(c->name).append(" ").append(ConvToStr(c->age)).append(" +").append(modes).append(params).append("\r\n");
diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp
index a2aff74f9..01638f9ac 100644
--- a/src/modules/m_spanningtree/opertype.cpp
+++ b/src/modules/m_spanningtree/opertype.cpp
@@ -35,8 +35,8 @@ bool TreeSocket::OperType(const std::string &prefix, std::deque<std::string> &pa
if (!u->IsModeSet('o'))
this->Instance->Users->all_opers.push_back(u);
u->modes[UM_OPERATOR] = 1;
- u->oper.assign(opertype, 0, NICKMAX - 1);
- Utils->DoOneToAllButSender(u->uuid,"OPERTYPE",params,u->server);
+ u->oper.assign(opertype, 0, Instance->Config->Limits.NickMax);
+ Utils->DoOneToAllButSender(u->uuid, "OPERTYPE", params, u->server);
TreeServer* remoteserver = Utils->FindServer(u->server);
bool dosend = true;
diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp
index ee4addb74..5f9f94e95 100644
--- a/src/modules/m_spanningtree/svsjoin.cpp
+++ b/src/modules/m_spanningtree/svsjoin.cpp
@@ -35,9 +35,6 @@ bool TreeSocket::ServiceJoin(const std::string &prefix, std::deque<std::string>
if (params.size() < 2)
return true;
- if (!this->Instance->IsChannel(params[1].c_str()))
- return true;
-
User* u = this->Instance->FindNick(params[0]);
if (u)
diff --git a/src/modules/m_spanningtree/svspart.cpp b/src/modules/m_spanningtree/svspart.cpp
index 00fd9eb3a..639792be9 100644
--- a/src/modules/m_spanningtree/svspart.cpp
+++ b/src/modules/m_spanningtree/svspart.cpp
@@ -35,9 +35,6 @@ bool TreeSocket::ServicePart(const std::string &prefix, std::deque<std::string>
if (params.size() < 2)
return true;
- if (!this->Instance->IsChannel(params[1].c_str()))
- return true;
-
User* u = this->Instance->FindNick(params[0]);
Channel* c = this->Instance->FindChan(params[1]);
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index 70f7b874c..d84ee2a04 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -48,9 +48,6 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
time_t signon = ConvToInt(params[8]);
std::string empty;
- /* XXX probably validate UID length too -- w00t */
- cmd_validation valid[] = { {"Nickname", 2, NICKMAX}, {"Hostname", 3, 64}, {"Displayed hostname", 4, 64}, {"Ident", 5, IDENTMAX + 1}, {"GECOS", 9, MAXGECOS}, {"", 0, 0} };
-
TreeServer* remoteserver = Utils->FindServer(source);
if (!remoteserver)
@@ -66,16 +63,6 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
return true;
}
- for (size_t x = 0; valid[x].length; ++x)
- {
- if (params[valid[x].param].length() > valid[x].length)
- {
- this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction (" + valid[x].item + " > " + ConvToStr(valid[x].length) + ")");
- return true;
- }
- }
-
-
/* check for collision */
user_hash::iterator iter = this->Instance->Users->clientlist->find(params[2]);
@@ -109,12 +96,12 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
}
(*(this->Instance->Users->clientlist))[params[2]] = _new;
_new->SetFd(FD_MAGIC_NUMBER);
- _new->nick.assign(params[2], 0, NICKMAX - 1);
+ _new->nick.assign(params[2], 0, MAXBUF);
_new->host.assign(params[3], 0, 64);
_new->dhost.assign(params[4], 0, 64);
_new->server = this->Instance->FindServerNamePtr(remoteserver->GetName().c_str());
- _new->ident.assign(params[5], 0, IDENTMAX + 1);
- _new->fullname.assign(params[9], 0, MAXGECOS);
+ _new->ident.assign(params[5], 0, MAXBUF);
+ _new->fullname.assign(params[9], 0, MAXBUF);
_new->registered = REG_ALL;
_new->signon = signon;
_new->age = age_t;
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index ce19a67a3..c1c7e8421 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -100,7 +100,11 @@ class CommandSvshold : public Command
else if (parameters.size() >= 2)
{
/* full form to add a SVSHold */
- if (ServerInstance->IsNick(parameters[0].c_str()))
+
+ /* NOTE: We check nicks up to 512 in length here, as a hax to allow
+ * remote nicks that are longer than our configuration to be held
+ */
+ if (ServerInstance->IsNick(parameters[0].c_str(), 512))
{
// parameters[0] = w00t
// parameters[1] = 1h3m2s
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 3ae856b5e..62949e48a 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -137,7 +137,7 @@ class CommandWatch : public Command
CmdResult remove_watch(User* user, const char* nick)
{
// removing an item from the list
- if (!ServerInstance->IsNick(nick))
+ if (!ServerInstance->IsNick(nick, ServerInstance->Config->Limits.NickMax))
{
user->WriteNumeric(942, "%s %s :Invalid nickname", user->nick.c_str(), nick);
return CMD_FAILURE;
@@ -191,7 +191,7 @@ class CommandWatch : public Command
CmdResult add_watch(User* user, const char* nick)
{
- if (!ServerInstance->IsNick(nick))
+ if (!ServerInstance->IsNick(nick, ServerInstance->Config->Limits.NickMax))
{
user->WriteNumeric(942, "%s %s :Invalid nickname",user->nick.c_str(),nick);
return CMD_FAILURE;