summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h5
-rw-r--r--src/inspircd.cpp12
-rw-r--r--src/xline.cpp8
3 files changed, 21 insertions, 4 deletions
diff --git a/include/users.h b/include/users.h
index a897d8282..a607f12c5 100644
--- a/include/users.h
+++ b/include/users.h
@@ -179,6 +179,11 @@ class userrec : public connection
*/
std::string recvq;
+ /** Flood counters
+ */
+ long lines_in;
+ time_t reset_due;
+
userrec();
virtual ~userrec() { }
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c42306a30..2558f3efc 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -4101,6 +4101,18 @@ int InspIRCd(void)
while (current->BufferIsReady())
{
floodlines++;
+ if (TIME > current->reset_due)
+ {
+ current->reset_due = TIME+3;
+ current->lines_in = 0;
+ }
+ current->lines_in++;
+ if (current->lines_in > current->flood)
+ {
+ log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
+ WriteOpers("*** Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
+ kill_link(current,"Excess flood");
+ }
if ((floodlines > current->flood) && (current->flood != 0))
{
if (current->registered == 7)
diff --git a/src/xline.cpp b/src/xline.cpp
index 35ebc50f3..92f5ac3a4 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -663,7 +663,7 @@ void apply_lines()
char* check = matches_gline(host);
if (check)
{
- WriteOpers("*** User %s matches G-Line: %s",u->registered == 7 ? u->second->nick:"<unknown>",check);
+ WriteOpers("*** User %s matches G-Line: %s",u->second->registered == 7 ? u->second->nick:"<unknown>",check);
snprintf(reason,MAXBUF,"G-Lined: %s",check);
kill_link(u->second,reason);
go_again = true;
@@ -675,7 +675,7 @@ void apply_lines()
char* check = matches_kline(host);
if (check)
{
- WriteOpers("*** User %s matches K-Line: %s",u->registered == 7 ? u->second->nick:"<unknown>",check);
+ WriteOpers("*** User %s matches K-Line: %s",u->second->registered == 7 ? u->second->nick:"<unknown>",check);
snprintf(reason,MAXBUF,"K-Lined: %s",check);
kill_link(u->second,reason);
go_again = true;
@@ -688,7 +688,7 @@ void apply_lines()
if (check)
{
snprintf(reason,MAXBUF,"Matched Q-Lined nick: %s",check);
- WriteOpers("*** Q-Lined nickname %s from %s: %s",u->registered == 7 ? u->second->nick:"<unknown>",u->second->host,check);
+ WriteOpers("*** Q-Lined nickname %s from %s: %s",u->second->registered == 7 ? u->second->nick:"<unknown>",u->second->host,check);
kill_link(u->second,reason);
go_again = true;
break;
@@ -700,7 +700,7 @@ void apply_lines()
if (check)
{
snprintf(reason,MAXBUF,"Z-Lined: %s",check);
- WriteOpers("*** User %s matches Z-Line: %s",u->registered == 7 ? u->second->nick:"<unknown>",u->second->host,check);
+ WriteOpers("*** User %s matches Z-Line: %s",u->second->registered == 7 ? u->second->nick:"<unknown>",u->second->host,check);
kill_link(u->second,reason);
go_again = true;
break;