1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 14:23:14 +02:00

Restrict the length of kick reasons in cs_kick, cs_ban, and cs_akick

This commit is contained in:
Adam
2012-11-25 22:37:54 -05:00
parent 80c573eed7
commit 1bdb756b25
6 changed files with 20 additions and 2 deletions
+6
View File
@@ -205,6 +205,12 @@ chanserv
* services immediately reversing topic changes.
*/
use_server_side_topiclock = yes
/*
* The maximum length of the reason field for user commands such as chanserv/kick
* and chanserv/ban.
*/
reasonmax = 200
}
/*
+2
View File
@@ -443,6 +443,8 @@ class CoreExport ServerConfig
bool UseServerSideMLock;
/* Use server side topic lock */
bool UseServerSideTopicLock;
/* The max length for reasons (cs_kick, cs_ban, etc) */
unsigned CSReasonMax;
/* Default botmodes on channels, defaults to ao */
Anope::string BotModes;
/* How long to wait between connection attempts */
+3
View File
@@ -56,6 +56,9 @@ class CommandCSAKick : public Command
NickCore *nc = NULL;
const AutoKick *akick;
if (reason.length() > Config->CSReasonMax)
reason = reason.substr(0, Config->CSReasonMax);
if (!na)
{
Anope::string nick, user, host;
+4 -1
View File
@@ -27,7 +27,7 @@ class CommandCSBan : public Command
{
const Anope::string &chan = params[0];
const Anope::string &target = params[1];
const Anope::string &reason = params.size() > 2 ? params[2] : "Requested";
Anope::string reason = params.size() > 2 ? params[2] : "Requested";
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
@@ -42,6 +42,9 @@ class CommandCSBan : public Command
AccessGroup u_access = source.AccessFor(ci);
if (reason.length() > Config->CSReasonMax)
reason = reason.substr(0, Config->CSReasonMax);
if (!c)
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
else if (!u_access.HasPriv("BAN"))
+4 -1
View File
@@ -27,7 +27,7 @@ class CommandCSKick : public Command
{
const Anope::string &chan = params[0];
const Anope::string &target = params[1];
const Anope::string &reason = params.size() > 2 ? params[2] : "Requested";
Anope::string reason = params.size() > 2 ? params[2] : "Requested";
User *u = source.GetUser();
ChannelInfo *ci = ChannelInfo::Find(params[0]);
@@ -45,6 +45,9 @@ class CommandCSKick : public Command
return;
}
if (reason.length() > Config->CSReasonMax)
reason = reason.substr(0, Config->CSReasonMax);
AccessGroup u_access = source.AccessFor(ci);
if (!u_access.HasPriv("KICK"))
+1
View File
@@ -1287,6 +1287,7 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{"chanserv", "require", "", new ValueContainerString(&conf->CSRequire), DT_STRING, NoValidation},
{"chanserv", "use_server_side_mlock", "yes", new ValueContainerBool(&conf->UseServerSideMLock), DT_BOOLEAN, NoValidation},
{"chanserv", "use_server_side_topiclock", "yes", new ValueContainerBool(&conf->UseServerSideTopicLock), DT_BOOLEAN, NoValidation},
{"chanserv", "reasonmax", "200", new ValueContainerUInt(&conf->CSReasonMax), DT_UINTEGER, NoValidation},
{"memoserv", "name", "", new ValueContainerString(&conf->MemoServ), DT_STRING, NoValidation},
{"memoserv", "maxmemos", "0", new ValueContainerUInt(&conf->MSMaxMemos), DT_UINTEGER, NoValidation},
{"memoserv", "senddelay", "0", new ValueContainerTime(&conf->MSSendDelay), DT_TIME, NoValidation},