summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-29 07:16:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-29 07:16:04 +0000
commit90466a6f9fc66e7275aa134569364fa75e2b074b (patch)
tree5ed93db9e0f115281cde9664bc5199447d122ed7 /src/inspircd.cpp
parent80015fe115f37243e7b75a48312edb5a029fa229 (diff)
Added code to detect and set local zlines for "flood from unregistered connection"
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1257 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index cb702245c..369c1f4c4 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -4068,8 +4068,6 @@ int InspIRCd(void)
result = read(count2a->second->fd, data, 65535);
if (result)
{
- if (result > 0)
- data[result] = '\0';
// perform a check on the raw buffer as an array (not a string!) to remove
// characters 0 and 7 which are illegal in the RFC - replace them with spaces.
// hopefully this should stop even more people whining about "Unknown command: *"
@@ -4078,11 +4076,26 @@ int InspIRCd(void)
if ((data[checker] == 0) || (data[checker] == 7))
data[checker] = ' ';
}
+ if (result > 0)
+ data[result] = '\0';
userrec* current = count2a->second;
int currfd = current->fd;
- //char* l = strtok(data,"\n");
int floodlines = 0;
current->AddBuffer(data);
+ if (current->recvq.length() > NetBufferSize)
+ {
+ if (current->registered == 7)
+ {
+ kill_link(current,"RecvQ exceeded");
+ goto label;
+ }
+ else
+ {
+ add_zline(120,ServerName,"Flood from unregistered connection",current->ip);
+ apply_lines();
+ goto label;
+ }
+ }
// while there are complete lines to process...
while (current->BufferIsReady())
{
@@ -4094,19 +4107,15 @@ int InspIRCd(void)
kill_link(current,"Excess flood");
goto label;
}
- char sanitized[NetBufferSize];
- memset(sanitized, 0, NetBufferSize);
+ char sanitized[MAXBUF];
// use GetBuffer to copy single lines into the sanitized string
strlcpy(sanitized,current->GetBuffer().c_str(),MAXBUF);
if (*sanitized)
{
-
-
// we're gonna re-scan to check if the nick is gone, after every
// command - if it has, we're gonna bail
bool find_again = false;
process_buffer(sanitized,current);
-
// look for the user's record in case it's changed
for (user_hash::iterator c2 = clientlist.begin(); c2 != clientlist.end(); c2++)
{
@@ -4122,7 +4131,6 @@ int InspIRCd(void)
goto label;
}
- //l = strtok(NULL,"\n");
}
goto label;
}