mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Fix one issue, add another feature: When sending MODE +beI, weed out duplicates with simple O(1) check so that users dont send MODE #chan +bbbbbbbbbbbb.
Allow configuration of which listmodes you want to deny to below halfops. For example <options hidemodes="eI">. This is because blocking +b can break mirc, blocking +eI usually wont break it so severely. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6852 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
395666b7e9
commit
569114e4c2
@ -853,10 +853,11 @@
|
||||
# authentication, this option can be used to turn it #
|
||||
# off. #
|
||||
# #
|
||||
# hidemodes - If this option is enabled, then listmodes, for #
|
||||
# example +beI, will be hidden from users below #
|
||||
# halfop. This is not recommended, as it may break #
|
||||
# some features in popular clients such as mIRC. #
|
||||
# hidemodes - If this option is enabled, then the listmodes #
|
||||
# given (e.g. +eI), will be hidden from users below #
|
||||
# halfop. This is not recommended to be set on mode #
|
||||
# +b, as it may break some features in popular #
|
||||
# clients such as mIRC. #
|
||||
# #
|
||||
|
||||
<options prefixquit="Quit: "
|
||||
@ -885,7 +886,7 @@
|
||||
announcets="yes"
|
||||
disablehmac="no"
|
||||
hostintopic="yes"
|
||||
hidemodes="no"
|
||||
hidemodes="eI"
|
||||
allowhalfop="yes">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#- TIME SYNC OPTIONS -#-#-#-#-#-#-#-#-#-#-#-#
|
||||
|
@ -353,7 +353,7 @@ class ServerConfig : public Extensible
|
||||
* MODE #chan b) are hidden from unprivileged
|
||||
* users.
|
||||
*/
|
||||
bool HideModeLists;
|
||||
bool HideModeLists[256];
|
||||
|
||||
/** The number of seconds the DNS subsystem
|
||||
* will wait before timing out any request.
|
||||
|
@ -30,7 +30,7 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
*UserStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = *SuffixQuit = '\0';
|
||||
WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
|
||||
log_file = NULL;
|
||||
HideModeLists = NoUserDns = forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = UndernetMsgPrefix = false;
|
||||
NoUserDns = forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = UndernetMsgPrefix = false;
|
||||
CycleHosts = writelog = AllowHalfop = true;
|
||||
dns_timeout = DieDelay = 5;
|
||||
MaxTargets = 20;
|
||||
@ -333,6 +333,14 @@ bool ValidateRules(ServerConfig* conf, const char* tag, const char* value, Value
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateModeLists(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
|
||||
{
|
||||
memset(conf->HideModeLists, 0, 256);
|
||||
for (const unsigned char* x = (const unsigned char*)data.GetString(); *x; ++x)
|
||||
conf->HideModeLists[*x] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateWhoWas(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
|
||||
{
|
||||
conf->WhoWasMaxKeep = conf->GetInstance()->Duration(data.GetString());
|
||||
@ -558,6 +566,7 @@ void ServerConfig::Read(bool bail, userrec* user)
|
||||
{
|
||||
static char debug[MAXBUF]; /* Temporary buffer for debugging value */
|
||||
static char maxkeep[MAXBUF]; /* Temporary buffer for WhoWasMaxKeep value */
|
||||
static char hidemodes[MAXBUF]; /* Modes to not allow listing from users below halfop */
|
||||
int rem = 0, add = 0; /* Number of modules added, number of modules removed */
|
||||
std::ostringstream errstr; /* String stream containing the error output */
|
||||
|
||||
@ -602,7 +611,7 @@ void ServerConfig::Read(bool bail, userrec* user)
|
||||
{"options", "ircumsgprefix","0", new ValueContainerBool (&this->UndernetMsgPrefix), DT_BOOLEAN, NoValidation},
|
||||
{"options", "announceinvites", "1", new ValueContainerBool (&this->AnnounceInvites), DT_BOOLEAN, NoValidation},
|
||||
{"options", "hostintopic", "1", new ValueContainerBool (&this->FullHostInTopic), DT_BOOLEAN, NoValidation},
|
||||
{"options", "hidemodes", "0", new ValueContainerBool (&this->HideModeLists), DT_BOOLEAN, NoValidation},
|
||||
{"options", "hidemodes", "", new ValueContainerChar (hidemodes), DT_CHARPTR, ValidateModeLists},
|
||||
{"pid", "file", "", new ValueContainerChar (this->PID), DT_CHARPTR, NoValidation},
|
||||
{"whowas", "groupsize", "10", new ValueContainerInt (&this->WhoWasGroupSize), DT_INTEGER, NoValidation},
|
||||
{"whowas", "maxgroups", "10240", new ValueContainerInt (&this->WhoWasMaxGroups), DT_INTEGER, NoValidation},
|
||||
|
18
src/mode.cpp
18
src/mode.cpp
@ -283,8 +283,11 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
|
||||
{
|
||||
const char* mode = parameters[1];
|
||||
int nonlistmodes_found = 0;
|
||||
bool sent[256];
|
||||
|
||||
mask = MASK_CHANNEL;
|
||||
|
||||
memset(&sent, 0, 256);
|
||||
|
||||
while (mode && *mode)
|
||||
{
|
||||
@ -294,7 +297,20 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ServerInstance->Config->HideModeLists && (targetchannel->GetStatus(user) < STATUS_HOP))
|
||||
/* Ensure the user doesnt request the same mode twice,
|
||||
* so they cant flood themselves off out of idiocy.
|
||||
*/
|
||||
if (!sent[*mode])
|
||||
{
|
||||
sent[*mode] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ServerInstance->Config->HideModeLists[*mode] && (targetchannel->GetStatus(user) < STATUS_HOP))
|
||||
{
|
||||
user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++);
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user