aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-08-13 16:56:24 -0400
committerGravatar Daniel De Graaf2010-08-13 16:56:24 -0400
commit7cfd4039ca3a835abfa88dfd595187fb11aa6901 (patch)
tree360b659045ea6a9b5b6d5227a7ff4da0e5ab4c44 /src
parentRemove Limits.Finalise(), doing this is completely incorrect (diff)
Remove duplicated settings now solely defined by the <connect> class
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp27
-rw-r--r--src/command_parse.cpp12
-rw-r--r--src/configreader.cpp4
-rw-r--r--src/modules/m_ident.cpp3
-rw-r--r--src/server.cpp2
-rw-r--r--src/users.cpp22
6 files changed, 23 insertions, 47 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index ee9cb7227..1d614b1e4 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -209,30 +209,19 @@ Channel* Channel::JoinUser(User *user, const std::string& cn, bool override, con
/*
* We don't restrict the number of channels that remote users or users that are override-joining may be in.
- * We restrict local users to MaxChans channels.
- * We restrict local operators to OperMaxChans channels.
+ * We restrict local users to the maximum defined in their <connect> block
* This is a lot more logical than how it was formerly. -- w00t
*/
if (IS_LOCAL(user) && !override)
{
- if (user->HasPrivPermission("channels/high-join-limit"))
+ unsigned int maxchans = user->GetClass()->maxchans;
+ // default if not set in <connect> is 20
+ if (!maxchans)
+ maxchans = 20;
+ if (user->chans.size() >= maxchans)
{
- if (user->chans.size() >= ServerInstance->Config->OperMaxChans)
- {
- user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn.c_str());
- return NULL;
- }
- }
- else
- {
- unsigned int maxchans = user->GetClass()->maxchans;
- if (!maxchans)
- maxchans = ServerInstance->Config->MaxChans;
- if (user->chans.size() >= maxchans)
- {
- user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn.c_str());
- return NULL;
- }
+ user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn.c_str());
+ return NULL;
}
}
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 729fd3089..c6afe8f86 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -191,14 +191,7 @@ bool CommandParser::ProcessCommand(LocalUser *user, std::string &cmd)
/* find the command, check it exists */
Commandtable::iterator cm = cmdlist.find(command);
- /* Modify the user's penalty regardless of whether or not the command exists */
bool do_more = true;
- if (!user->HasPrivPermission("users/flood/no-throttle"))
- {
- // If it *doesn't* exist, give it a slightly heftier penalty than normal to deter flooding us crap
- user->CommandFloodPenalty += cm != cmdlist.end() ? cm->second->Penalty * 1000 : 2000;
- }
-
if (cm == cmdlist.end())
{
@@ -219,11 +212,16 @@ bool CommandParser::ProcessCommand(LocalUser *user, std::string &cmd)
{
if (user->registered == REG_ALL)
user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s %s :Unknown command",user->nick.c_str(),command.c_str());
+ // don't flood crap, please
+ user->CommandFloodPenalty += 2000;
ServerInstance->stats->statsUnknown++;
return true;
}
}
+ // account for the penalty of the command
+ user->CommandFloodPenalty += cm->second->Penalty * 1000;
+
if (cm->second->max_params && command_p.size() > cm->second->max_params)
{
/*
diff --git a/src/configreader.cpp b/src/configreader.cpp
index afe05ea97..3c843f835 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -28,8 +28,6 @@ ServerConfig::ServerConfig()
NetBufferSize = 10240;
SoftLimit = ServerInstance->SE->GetMaxFds();
MaxConn = SOMAXCONN;
- MaxChans = 20;
- OperMaxChans = 30;
c_ipv4_range = 32;
c_ipv6_range = 128;
}
@@ -431,8 +429,6 @@ void ServerConfig::Fill()
WhoWasGroupSize = ConfValue("whowas")->getInt("groupsize");
WhoWasMaxGroups = ConfValue("whowas")->getInt("maxgroups");
WhoWasMaxKeep = ServerInstance->Duration(ConfValue("whowas")->getString("maxkeep"));
- MaxChans = ConfValue("channels")->getInt("users", 20);
- OperMaxChans = ConfValue("channels")->getInt("opers", 60);
c_ipv4_range = ConfValue("cidr")->getInt("ipv4clone", 32);
c_ipv6_range = ConfValue("cidr")->getInt("ipv6clone", 128);
Limits.NickMax = ConfValue("limits")->getInt("maxnick", 32);
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 6c1148cfc..a93c7ed22 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -229,7 +229,7 @@ class IdentRequestSocket : public EventHandler
/* Truncate the ident at any characters we don't like, skip leading spaces */
size_t k = 0;
- for (const char *j = token.c_str(); *j && (k < ServerInstance->Config->Limits.IdentMax + 1); j++)
+ for (const char *j = token.c_str(); *j && (k++ < ServerInstance->Config->Limits.IdentMax); j++)
{
if (*j == ' ')
continue;
@@ -244,7 +244,6 @@ class IdentRequestSocket : public EventHandler
break;
}
- /* Re-check with IsIdent, in case that changes and this doesn't (paranoia!) */
if (!ident.empty() && ServerInstance->IsIdent(ident.c_str()))
{
result = ident;
diff --git a/src/server.cpp b/src/server.cpp
index 3f86a348e..a52cde91f 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -75,7 +75,7 @@ void InspIRCd::BuildISupport()
{
// the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
std::stringstream v;
- v << "WALLCHOPS WALLVOICES MODES=" << Config->Limits.MaxModes - 1 << " CHANTYPES=# PREFIX=" << this->Modes->BuildPrefixes() << " MAP MAXCHANNELS=" << Config->MaxChans << " MAXBANS=60 VBANLIST NICKLEN=" << Config->Limits.NickMax - 1;
+ v << "WALLCHOPS WALLVOICES MODES=" << Config->Limits.MaxModes - 1 << " CHANTYPES=# PREFIX=" << this->Modes->BuildPrefixes() << " MAP MAXBANS=60 VBANLIST NICKLEN=" << Config->Limits.NickMax - 1;
v << " CASEMAPPING=rfc1459 STATUSMSG=" << Modes->BuildPrefixes(false) << " CHARSET=ascii TOPICLEN=" << Config->Limits.MaxTopic - 1 << " KICKLEN=" << Config->Limits.MaxKick - 1 << " MAXTARGETS=" << Config->MaxTargets - 1;
v << " AWAYLEN=" << Config->Limits.MaxAway - 1 << " CHANMODES=" << this->Modes->GiveModeList(MODETYPE_CHANNEL) << " FNC NETWORK=" << Config->Network << " MAXPARA=32 ELIST=MU";
Config->data005 = v.str();
diff --git a/src/users.cpp b/src/users.cpp
index 8a239a2d8..1fc51661b 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -465,18 +465,14 @@ void UserIOHandler::OnDataReady()
if (user->quitting)
return;
- if (recvq.length() > user->MyClass->recvqmax && !user->HasPrivPermission("users/flood/increased-buffers"))
+ if (recvq.length() > user->MyClass->recvqmax)
{
ServerInstance->Users->QuitUser(user, "RecvQ exceeded");
- ServerInstance->SNO->WriteToSnoMask('a', "User %s RecvQ of %lu exceeds connect class maximum of %lu",
- user->nick.c_str(), (unsigned long)recvq.length(), user->MyClass->recvqmax);
+ ServerInstance->SNO->WriteToSnoMask('a', "User %s RecvQ exceeds maximum of %lu (class %s)",
+ user->nick.c_str(), user->MyClass->recvqmax, user->MyClass->name.c_str());
}
- unsigned long sendqmax = ULONG_MAX;
- if (!user->HasPrivPermission("users/flood/increased-buffers"))
- sendqmax = user->MyClass->softsendqmax;
- unsigned long penaltymax = ULONG_MAX;
- if (!user->HasPrivPermission("users/flood/no-fakelag"))
- penaltymax = user->MyClass->penaltythreshold * 1000;
+ unsigned long sendqmax = user->MyClass->softsendqmax;
+ unsigned long penaltymax = user->MyClass->penaltythreshold * 1000;
while (user->CommandFloodPenalty < penaltymax && getSendQSize() < sendqmax)
{
@@ -505,7 +501,6 @@ eol_found:
// just found a newline. Terminate the string, and pull it out of recvq
recvq = recvq.substr(qpos);
- // TODO should this be moved to when it was inserted in recvq?
ServerInstance->stats->statsRecv += qpos;
user->bytes_in += qpos;
user->cmds_in++;
@@ -523,16 +518,15 @@ eol_found:
void UserIOHandler::AddWriteBuf(const std::string &data)
{
- if (!user->quitting && getSendQSize() + data.length() > user->MyClass->hardsendqmax &&
- !user->HasPrivPermission("users/flood/increased-buffers"))
+ if (!user->quitting && getSendQSize() + data.length() > user->MyClass->hardsendqmax)
{
/*
* Quit the user FIRST, because otherwise we could recurse
* here and hit the same limit.
*/
ServerInstance->Users->QuitUser(user, "SendQ exceeded");
- ServerInstance->SNO->WriteToSnoMask('a', "User %s SendQ exceeds connect class maximum of %lu",
- user->nick.c_str(), user->MyClass->hardsendqmax);
+ ServerInstance->SNO->WriteToSnoMask('a', "User %s SendQ exceeds maximum of %lu (class %s)",
+ user->nick.c_str(), user->MyClass->hardsendqmax, user->MyClass->name.c_str());
return;
}