diff options
author | Stefan Hacker <dd0t@users.sourceforge.net> | 2018-06-14 01:47:17 +0300 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2018-06-14 01:50:50 +0300 |
commit | 9e0526c485d3627c60c4fb07789165302a158ed4 (patch) | |
tree | 6fb437496c6ae4ca31d0f9b86d064c429852eb14 /src/murmur/Messages.cpp | |
parent | e85191b28410226a5c8d4166e4ce8ff1391c952a (diff) |
Introduce channelcountlimit to limit max channels per server
Having to many channels on a server can impact performance to the point
of making the instance unusably slow. This can be a problem for hosters
that allow their users unlimited channel creation.
This patch introduces a new per-server configuration parameter
channelcountlimit which can be used to configure a maximum number of
channels that may be created on each of the virtual servers. Once the
limit is reached channel creation will be rejected with permission
denied.
To allow a translated error message we have to bump the client version
to 1.3.1 to be able to use a fallback message for older clients.
As usual dbus, ice and grpc can ignore this limit. It is only enforced
against clients.
Diffstat (limited to 'src/murmur/Messages.cpp')
-rw-r--r-- | src/murmur/Messages.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp index b5d79b85b..900acddc5 100644 --- a/src/murmur/Messages.cpp +++ b/src/murmur/Messages.cpp @@ -896,6 +896,11 @@ void Server::msgChannelState(ServerUser *uSource, MumbleProto::ChannelState &msg if (! p || qsName.isNull()) return; + if (iChannelCountLimit == 0 || qhChannels.count() >= iChannelCountLimit) { + PERM_DENIED_FALLBACK(ChannelCountLimit, 0x010301, QLatin1String("Channel count limit reached")); + return; + } + ChanACL::Perm perm = msg.temporary() ? ChanACL::MakeTempChannel : ChanACL::MakeChannel; if (! hasPermission(uSource, p, perm)) { PERM_DENIED(uSource, p, perm); |