From 65d3f80df5b672bffb00355892bf6454b488caf9 Mon Sep 17 00:00:00 2001 From: frostycoolslug Date: Sun, 22 Jan 2006 11:24:08 +0000 Subject: Stopped lines longer than 512b from being killed, instead, warning sent and dropped. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2824 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/userprocess.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 3e1cedb11..41a860d9b 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -127,8 +127,24 @@ void ProcessUser(userrec* cu) { // AddBuffer returned false, theres too much data in the user's buffer and theyre up to no good. if (current->registered == 7) - { - kill_link(current,"RecvQ exceeded"); + { + // Make sure they arn't flooding long lines. + if (TIME > current->reset_due) + { + current->reset_due = TIME + current->threshold; + 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"); + return; + } else { + WriteServ(currfd, "NOTICE %s :Your previous line was too long and was not delivered (Over 512chars) Please shorten it.", current->nick); + current->recvq = ""; + } } else { -- cgit v1.2.3