mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Special check in cmd_quit and cmd_kill and special return value CMD_USER_DELETED, to prevent theoretical segfault (this isnt the bug youre trying to find, pip)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5230 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
7b3b742d63
commit
c06d4197af
@ -32,6 +32,7 @@ enum CmdResult
|
||||
CMD_FAILURE = 0, /* Command exists, but failed */
|
||||
CMD_SUCCESS = 1, /* Command exists, and succeeded */
|
||||
CMD_INVALID = 2, /* Command doesnt exist at all! */
|
||||
CMD_USER_DELETED = 3, /* User was deleted! */
|
||||
};
|
||||
|
||||
/** A structure that defines a command
|
||||
|
@ -66,6 +66,11 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
u->PurgeEmptyChannels();
|
||||
}
|
||||
|
||||
if (u == user)
|
||||
{
|
||||
FOREACH_MOD(I_OnPostCommand,OnPostCommand("KILL", parameters, pcnt, user, CMD_SUCCESS));
|
||||
return CMD_USER_DELETED;
|
||||
}
|
||||
DELETE(u);
|
||||
}
|
||||
else
|
||||
|
@ -99,8 +99,9 @@ CmdResult cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
if (user->registered == REG_ALL) {
|
||||
user->PurgeEmptyChannels();
|
||||
}
|
||||
DELETE(user);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
FOREACH_MOD(I_OnPostCommand,OnPostCommand("QUIT", parameters, pcnt, user, CMD_SUCCESS));
|
||||
DELETE(user);
|
||||
return CMD_USER_DELETED;
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,10 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
|
||||
*/
|
||||
CmdResult result = cm->second->Handle(command_p,items,user);
|
||||
|
||||
FOREACH_MOD(I_OnPostCommand,OnPostCommand(command, command_p, items, user, result));
|
||||
if (result != CMD_USER_DELETED)
|
||||
{
|
||||
FOREACH_MOD(I_OnPostCommand,OnPostCommand(command, command_p, items, user, result));
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user