From 47a4c36063749a8dc52dbbd5caba5c4c6f7aaf1c Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 12 Jul 2007 18:42:17 +0000 Subject: Implement a way to disable options:maxwho, bug #348 git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7437 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/inspircd.conf.example | 4 +++- src/cmd_who.cpp | 2 +- src/configreader.cpp | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example index 695fa2fdb..823998b30 100644 --- a/docs/inspircd.conf.example +++ b/docs/inspircd.conf.example @@ -742,7 +742,9 @@ # query. This is to prevent /WHO being used as a # # spam vector or means of flooding an ircd. The # # default is 128, it is not recommended to raise it # -# above 1024. Values up to 65535 are permitted. # +# above 1024. Values up to 65535 are permitted. If # +# this value is omitted, any size WHO is allowed by # +# anyone. # # # # somaxconn - The maximum number of sockets that may be waiting # # in the accept queue. This usually allows the ircd # diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index 66a94cfd6..31e8030f5 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -312,7 +312,7 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user) } } /* Send the results out */ - if ((whoresults.size() <= (size_t)ServerInstance->Config->MaxWhoResults) || opt_unlimit) + if ((ServerInstance->Config->MaxWhoResults && (whoresults.size() <= (size_t)ServerInstance->Config->MaxWhoResults)) || opt_unlimit) { for (std::vector::const_iterator n = whoresults.begin(); n != whoresults.end(); n++) user->WriteServ(*n); diff --git a/src/configreader.cpp b/src/configreader.cpp index 88b8a9af3..d4291692f 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -37,7 +37,7 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance) NetBufferSize = 10240; SoftLimit = MAXCLIENTS; MaxConn = SOMAXCONN; - MaxWhoResults = 100; + MaxWhoResults = 0; debugging = 0; MaxChans = 20; OperMaxChans = 30; @@ -297,9 +297,9 @@ bool ValidateNetBufferSize(ServerConfig* conf, const char* tag, const char* valu bool ValidateMaxWho(ServerConfig* conf, const char* tag, const char* value, ValueItem &data) { - if ((!data.GetInteger()) || (data.GetInteger() > 65535) || (data.GetInteger() < 1)) + if ((data.GetInteger() > 65535) || (data.GetInteger() < 1)) { - conf->GetInstance()->Log(DEFAULT,"No MaxWhoResults specified or size out of range, setting to default of 128."); + conf->GetInstance()->Log(DEFAULT," size out of range, setting to default of 128."); data.Set(128); } return true; -- cgit v1.2.3