diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 11 | ||||
-rw-r--r-- | src/users.cpp | 5 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index a4e9b1934..cf68705cb 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -357,7 +357,7 @@ void readfile(file_cache &F, const char* fname) void ReadConfig(bool bail, userrec* user) { char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF],MW[MAXBUF]; - char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF],DNT[MAXBUF],pfreq[MAXBUF],thold[MAXBUF],sqmax[MAXBUF]; + char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF],DNT[MAXBUF],pfreq[MAXBUF],thold[MAXBUF],sqmax[MAXBUF],rqmax[MAXBUF]; ConnectClass c; std::stringstream errstr; @@ -464,6 +464,7 @@ void ReadConfig(bool bail, userrec* user) ConfValue("connect","pingfreq",i,pfreq,&config_f); ConfValue("connect","threshold",i,thold,&config_f); ConfValue("connect","sendq",i,sqmax,&config_f); + ConfValue("connect","recvq",i,rqmax,&config_f); if (Value[0]) { strlcpy(c.host,Value,MAXBUF); @@ -476,6 +477,7 @@ void ReadConfig(bool bail, userrec* user) c.flood = atoi(flood); c.threshold = 5; c.sendqmax = 262144; // 256k + c.recvqmax = 4096; // 4k if (atoi(thold)>0) { c.threshold = atoi(thold); @@ -484,6 +486,10 @@ void ReadConfig(bool bail, userrec* user) { c.sendqmax = atoi(sqmax); } + if (atoi(rqmax)>0) + { + c.recvqmax = atoi(rqmax); + } if (atoi(timeout)>0) { c.registration_timeout = atoi(timeout); @@ -2540,6 +2546,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip) int class_flood = 0; long class_threshold = 5; long class_sqmax = 262144; // 256kb + long class_rqmax = 4096; // 4k for (ClassVector::iterator i = Classes.begin(); i != Classes.end(); i++) { @@ -2550,6 +2557,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip) clientlist[tempnick]->pingmax = i->pingtime; class_threshold = i->threshold; class_sqmax = i->sendqmax; + class_rqmax = i->recvqmax; break; } } @@ -2559,6 +2567,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip) clientlist[tempnick]->flood = class_flood; clientlist[tempnick]->threshold = class_threshold; clientlist[tempnick]->sendqmax = class_sqmax; + clientlist[tempnick]->recvqmax = class_rqmax; for (int i = 0; i < MAXCHANS; i++) { diff --git a/src/users.cpp b/src/users.cpp index 9d0367a9a..0060b45ee 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -183,6 +183,11 @@ bool userrec::AddBuffer(std::string a) if (recvq[i++] == '\n') break; } + if (recvq.length() > this->recvqmax) + { + this->SetWriteError("RecvQ exceeded"); + WriteOpers("*** User %s RecvQ of %d exceeds connect class maximum of %d",this->nick,recvq.length(),this->recvqmax); + } // return false if we've had more than 600 characters WITHOUT // a carriage return (this is BAD, drop the socket) return (i < 600); |