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:
@@ -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
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user