summaryrefslogtreecommitdiff
path: root/src/command_parse.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-25 15:25:32 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-25 15:25:32 +0000
commit393c1afdd7bfede2b7f489d7ceb000c909c0fccf (patch)
tree5b8d58a9f51c3511d7d9ccc9da7674e8df69cd2d /src/command_parse.cpp
parent7b3105e5d4ea1877f8c30daaf069839ea890752d (diff)
this should fix any of the crashes w00t outlined where User::MyClass == NULL.
The simplest fix seems to be that if the user has no class, skip all the code that uses the class values. This makes sense because the only situation where User::MyClass == NULL is when they arent authorised to connect and are being quit so checking flood levels and max sendq etc are irrelevent. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8358 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/command_parse.cpp')
-rw-r--r--src/command_parse.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 9df7f4754..5492e26b5 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -223,22 +223,25 @@ void CommandParser::DoLines(User* current, bool one_only)
while (current->BufferIsReady())
{
- if (ServerInstance->Time() > current->reset_due)
+ if (current->MyClass)
{
- current->reset_due = ServerInstance->Time() + current->MyClass->GetThreshold();
- current->lines_in = 0;
- }
+ if (ServerInstance->Time() > current->reset_due)
+ {
+ current->reset_due = ServerInstance->Time() + current->MyClass->GetThreshold();
+ current->lines_in = 0;
+ }
- if (++current->lines_in > current->MyClass->GetFlood() && current->MyClass->GetFlood())
- {
- ServerInstance->FloodQuitUser(current);
- return;
- }
+ if (++current->lines_in > current->MyClass->GetFlood() && current->MyClass->GetFlood())
+ {
+ ServerInstance->FloodQuitUser(current);
+ return;
+ }
- if ((++floodlines > current->MyClass->GetFlood()) && (current->MyClass->GetFlood() != 0))
- {
- ServerInstance->FloodQuitUser(current);
- return;
+ if ((++floodlines > current->MyClass->GetFlood()) && (current->MyClass->GetFlood() != 0))
+ {
+ ServerInstance->FloodQuitUser(current);
+ return;
+ }
}
// use GetBuffer to copy single lines into the sanitized string
@@ -305,7 +308,9 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd)
}
/* activity resets the ping pending timer */
- user->nping = ServerInstance->Time() + user->MyClass->GetPingTime();
+ if (user->MyClass)
+ user->nping = ServerInstance->Time() + user->MyClass->GetPingTime();
+
if (cm->second->flags_needed)
{
if (!user->IsModeSet(cm->second->flags_needed))