From c511bb56f5ceff1e395d82c4bfd78e5c23aabab6 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 19 Mar 2014 20:52:56 +0000 Subject: Kill in favour of and . Remove channels/high-join-limit privilege --- docs/conf/inspircd.conf.example | 18 ++++-------------- docs/conf/opers.conf.example | 6 ++++-- include/configreader.h | 4 ++-- src/channels.cpp | 30 +++++++++++++----------------- src/configreader.cpp | 2 +- src/users.cpp | 2 +- 6 files changed, 25 insertions(+), 37 deletions(-) diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index fd625aef1..6ef9c9d11 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -262,8 +262,8 @@ password="secret" # maxchans: Maximum number of channels a user in this class - # be in at one time. This overrides every other maxchans setting. - #maxchans="30" + # be in at one time. + maxchans="20" # timeout: How long (in seconds) the server will wait before # disconnecting a user if they do not do anything on connect. @@ -335,8 +335,8 @@ allow="*" # maxchans: Maximum number of channels a user in this class - # be in at one time. This overrides every other maxchans setting. - #maxchans="30" + # be in at one time. + maxchans="20" # timeout: How long (in seconds) the server will wait before # disconnecting a user if they do not do anything on connect. @@ -454,16 +454,6 @@ # not when the command is run. # -#-#-#-#-#-#-#-#-#-#-#-# MAXIMUM CHANNELS -#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# # - - - #-#-#-#-#-#-#-#-#-#-#-#-#-#-# DNS SERVER -#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # If these values are not defined, InspIRCd uses the default DNS resolver # of your system. diff --git a/docs/conf/opers.conf.example b/docs/conf/opers.conf.example index 524ebce34..eef8039cb 100644 --- a/docs/conf/opers.conf.example +++ b/docs/conf/opers.conf.example @@ -25,14 +25,13 @@ # ACTIONS: # - users/mass-message: allows opers with this priv to PRIVMSG and NOTICE to a server mask (e.g. NOTICE $*) # - users/samode-usermodes: allows opers with this priv to change the user modes of any other user using /SAMODE - # - channels/high-join-limit: allows opers with this priv to join total channels instead of total channels. # PERMISSIONS: # - users/flood/no-fakelag: prevents opers from being penalized with fake lag for flooding (*NOTE) # - users/flood/no-throttle: allows opers with this priv to send commands without being throttled (*NOTE) # - users/flood/increased-buffers: allows opers with this priv to send and receive data without worrying about being disconnected for exceeding limits (*NOTE) # # *NOTE: These privs are potentially dangerous, as they grant users with them the ability to hammer your server's CPU/RAM as much as they want, essentially. - privs="users/auspex channels/auspex servers/auspex users/mass-message channels/high-join-limit users/flood/no-throttle users/flood/increased-buffers" + privs="users/auspex channels/auspex servers/auspex users/mass-message users/flood/no-throttle users/flood/increased-buffers" # usermodes: Oper-only usermodes that opers with this class can use. usermodes="*" @@ -64,6 +63,9 @@ # vhost: Host opers of this type get when they log in (oper up). This is optional. vhost="netadmin.omega.example.org" + # maxchans: Maximum number of channels opers of this type can be in at once. + maxchans="60" + # modes: User modes besides +o that are set on an oper of this type # when they oper up. Used for snomasks and other things. # Requires that m_opermodes.so be loaded. diff --git a/include/configreader.h b/include/configreader.h index ec9932658..f59fba389 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -446,11 +446,11 @@ class CoreExport ServerConfig */ OperIndex OperTypes; - /** Max channels per user + /** Default value for , deprecated in 2.2 */ unsigned int MaxChans; - /** Oper max channels per user + /** Default value for , deprecated in 2.2 */ unsigned int OperMaxChans; diff --git a/src/channels.cpp b/src/channels.cpp index 089b6927e..46f9cfe89 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -161,30 +161,26 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co /* * We don't restrict the number of channels that remote users or users that are override-joining may be in. - * We restrict local users to MaxChans channels. - * We restrict local operators to OperMaxChans channels. + * We restrict local users to channels. + * We restrict local operators to channels. * This is a lot more logical than how it was formerly. -- w00t */ if (!override) { - if (user->HasPrivPermission("channels/high-join-limit")) + unsigned int maxchans = user->GetClass()->maxchans; + if (user->IsOper()) { - if (user->chans.size() >= ServerInstance->Config->OperMaxChans) - { - user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s :You are on too many channels", cname.c_str()); - return NULL; - } + unsigned int opermaxchans = ConvToInt(user->oper->getConfig("maxchans")); + // If not set, use 2.0's , if that's not set either, use limit from CC + if (!opermaxchans) + opermaxchans = ServerInstance->Config->OperMaxChans; + if (opermaxchans) + maxchans = opermaxchans; } - else + if (user->chans.size() >= maxchans) { - unsigned int maxchans = user->GetClass()->maxchans; - if (!maxchans) - maxchans = ServerInstance->Config->MaxChans; - if (user->chans.size() >= maxchans) - { - user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s :You are on too many channels", cname.c_str()); - return NULL; - } + user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s :You are on too many channels", cname.c_str()); + return NULL; } } diff --git a/src/configreader.cpp b/src/configreader.cpp index cda5e03e0..c82bda479 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -392,7 +392,7 @@ void ServerConfig::Fill() DefaultModes = options->getString("defaultmodes", "not"); PID = ConfValue("pid")->getString("file"); MaxChans = ConfValue("channels")->getInt("users", 20); - OperMaxChans = ConfValue("channels")->getInt("opers", 60); + OperMaxChans = ConfValue("channels")->getInt("opers"); c_ipv4_range = ConfValue("cidr")->getInt("ipv4clone", 32); c_ipv6_range = ConfValue("cidr")->getInt("ipv6clone", 128); Limits.NickMax = ConfValue("limits")->getInt("maxnick", 32); diff --git a/src/users.cpp b/src/users.cpp index a15c31727..249f87850 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1252,7 +1252,7 @@ const std::string& FakeUser::GetFullRealHost() ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask) : config(tag), type(t), fakelag(true), name("unnamed"), registration_timeout(0), host(mask), pingtime(0), softsendqmax(0), hardsendqmax(0), recvqmax(0), - penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(0), + penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(ServerInstance->Config->MaxChans), limit(0), resolvehostnames(true) { } -- cgit v1.2.3