mirror of
https://github.com/anope/anope.git
synced 2026-06-25 07:56:38 +02:00
Return MOD_STOP in various places where the user executing the command had been killed, fixes a crash if a user gets killed for too many invalid passwords
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2885 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ E IRCDProto *ircdproto;
|
||||
/**** actions.c ****/
|
||||
|
||||
E void kill_user(const std::string &source, const std::string &user, const std::string &reason);
|
||||
E void bad_password(User *u);
|
||||
E bool bad_password(User *u);
|
||||
E void sqline(const std::string &mask, const std::string &reason);
|
||||
E void common_unban(ChannelInfo *ci, const std::string &nick);
|
||||
|
||||
|
||||
+8
-3
@@ -20,21 +20,26 @@
|
||||
* Note a bad password attempt for the given user. If they've used up
|
||||
* their limit, toss them off.
|
||||
* @param u the User to check
|
||||
* @return void
|
||||
* @return true if the user was killed, otherwise false
|
||||
*/
|
||||
void bad_password(User *u)
|
||||
bool bad_password(User *u)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
|
||||
if (!u || !Config.BadPassLimit)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (Config.BadPassTimeout > 0 && u->invalid_pw_time > 0 && u->invalid_pw_time < now - Config.BadPassTimeout)
|
||||
u->invalid_pw_count = 0;
|
||||
++u->invalid_pw_count;
|
||||
u->invalid_pw_time = now;
|
||||
if (u->invalid_pw_count >= Config.BadPassLimit)
|
||||
{
|
||||
kill_user("", u->nick, "Too many invalid passwords");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
+2
-1
@@ -54,7 +54,8 @@ class CommandNSGhost : public Command
|
||||
if (!res)
|
||||
{
|
||||
Alog() << Config.s_NickServ << ": GHOST: invalid password for " << nick << " by " << u->GetMask();
|
||||
bad_password(u);
|
||||
if (bad_password(u))
|
||||
return MOD_STOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -89,7 +89,8 @@ class CommandNSGroup : public Command
|
||||
{
|
||||
Alog() << Config.s_NickServ << ": Failed GROUP for " << u->GetMask() << " (invalid password)";
|
||||
notice_lang(Config.s_NickServ, u, PASSWORD_INCORRECT);
|
||||
bad_password(u);
|
||||
if (bad_password(u))
|
||||
return MOD_STOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -54,7 +54,8 @@ class CommandNSIdentify : public Command
|
||||
{
|
||||
Alog() << Config.s_NickServ << ": Failed IDENTIFY for " << u->nick << "!" << u->GetIdent() << "@" << u->host;
|
||||
notice_lang(Config.s_NickServ, u, PASSWORD_INCORRECT);
|
||||
bad_password(u);
|
||||
if (bad_password(u))
|
||||
return MOD_STOP;
|
||||
}
|
||||
else if (res == -1)
|
||||
notice_lang(Config.s_NickServ, u, NICK_IDENTIFY_FAILED);
|
||||
|
||||
@@ -62,7 +62,8 @@ class CommandNSRecover : public Command
|
||||
if (!res)
|
||||
{
|
||||
Alog() << Config.s_NickServ << ": RECOVER: invalid password for " << nick << " by " << u->GetMask();
|
||||
bad_password(u);
|
||||
if (bad_password(u))
|
||||
return MOD_STOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ class CommandNSRelease : public Command
|
||||
if (!res)
|
||||
{
|
||||
Alog() << Config.s_NickServ << ": RELEASE: invalid password for " << nick << " by " << u->GetMask();
|
||||
bad_password(u);
|
||||
if (bad_password(u))
|
||||
return MOD_STOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user