summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actions.c11
-rw-r--r--src/core/ns_ghost.c3
-rw-r--r--src/core/ns_group.c3
-rw-r--r--src/core/ns_identify.c3
-rw-r--r--src/core/ns_recover.c3
-rw-r--r--src/core/ns_release.c3
6 files changed, 18 insertions, 8 deletions
diff --git a/src/actions.c b/src/actions.c
index 39c646cce..eea1906ca 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -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;
}
/*************************************************************************/
diff --git a/src/core/ns_ghost.c b/src/core/ns_ghost.c
index 49c36b303..72b02efae 100644
--- a/src/core/ns_ghost.c
+++ b/src/core/ns_ghost.c
@@ -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;
}
}
}
diff --git a/src/core/ns_group.c b/src/core/ns_group.c
index 65b655ec7..bdf80d38d 100644
--- a/src/core/ns_group.c
+++ b/src/core/ns_group.c
@@ -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
{
diff --git a/src/core/ns_identify.c b/src/core/ns_identify.c
index a0a217677..f16b5e84c 100644
--- a/src/core/ns_identify.c
+++ b/src/core/ns_identify.c
@@ -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);
diff --git a/src/core/ns_recover.c b/src/core/ns_recover.c
index 0937d6891..3a0a9cedd 100644
--- a/src/core/ns_recover.c
+++ b/src/core/ns_recover.c
@@ -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;
}
}
}
diff --git a/src/core/ns_release.c b/src/core/ns_release.c
index 7ec6f85ee..a4169ecda 100644
--- a/src/core/ns_release.c
+++ b/src/core/ns_release.c
@@ -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;
}
}
}