Commit Graph

275 Commits

Author SHA1 Message Date
Robert Adam
dda161138b REFAC: Make sure all macros are #undef'd again
If they are not there is the potential of name clashes when performing a
unity build.

See: https://stackoverflow.com/questions/847974/the-benefits-disadvantages-of-unity-builds
2021-03-06 18:57:22 +01:00
Robert Adam
6657a6f2a1
Merge pull request #4817: FIX(Server): Unauthenticated connections no longer add to user count
This commit fixes both issues discussed in #4277 which were related to
the fact that any socket connection was allocated an ID and marked as
a user. This bug allowed for a malicious user to lock out all users of
a server regardless of server password usage. This change simply moves ID
allocation to after a connection is marked as Authenticated.

FIXES: #4277
2021-03-03 07:35:22 +01:00
Lucas Toole
eabfbab403 FIX(Server): Unauthenticated connections no longer add to user count
This commit fixes both issues discussed in #4277 which were related to
the fact that any socket connection was allocated an ID and marked as
a user. This bug allowed for a malicious user to lock out all users of
a server regardless of server password usage. This change simply moves ID
allocation to after a connection is marked as Authenticated.

FIXES: #4277
2021-03-02 08:59:28 -06:00
Robert Adam
59ae429972 MAINT: Update copyright notice to 2021
This was done by running scripts/updateLicenseHeaders.py and then
manually editing the LICENSE file.
2021-03-02 10:15:01 +01:00
Robert Adam
e3871336aa FIX(server): Older clients not being warned about ChannelListener
Clients < 1.4.0 don't know about the new ChannelListener feature and
thus there is no indication in the UI for them. In order to make sure
that users know that they could potentially be listened to without
seeing anything in the UI, a warning message was introduced in #4097.

There was an error in the implementation however causing this warning to
not be sent by the server if there are no explicit limits on the amount
of channel listeners via the server configuration.

The bug was that "no limit" was expressed as -1 but the check for
whether these features are enabled checked for > 0. The fix is simply to
check for != 0 instead.

Fixes #4687
2021-01-14 09:36:24 +01:00
Jannis Achstetter
e493c8e6e1 FORMAT(server): Add braces around foreach-loops and if-bodies 2020-10-23 15:16:09 +02:00
Jannis Achstetter
578b9a55b3 FEAT(server): Send text messages also to users only listening to channels
The "Channel Listeners" (#4011) feature allows users to hear the audio
from a channel without joining it. This commit also delivers text
messages to all users who are just "listening to" a channel this way.

Implements #4539
2020-10-23 15:15:55 +02:00
Jannis Achstetter
d1b99c8f6e DOCS(server): Add comments to Server::msgTextMessage 2020-10-22 22:59:55 +02:00
Robert
af7dac72f4 FORMAT: Run clang-format 10 on all C/CXX source-files 2020-09-11 18:29:33 +02:00
Robert Adam
ced1fdd37c FIX(cmake): Set QT_RESTRICTED_CAST_FROM_ASCII
With the old qmake buildsystem we used to set QT_NO_CAST_FROM_ASCII (for
the Mumble client) in order to avoid problems with character encodings
in our Strings. This was not done in the new cmake system yet.

Instead of the aforementioned macro, this commit sets (for all targets)
QT_RESTRICTED_CAST_FROM_ASCII instead in order to be able to
automatically convert direct String literals to QString as these usually
don't contain any problematic characters (non-ASCII) in the first place.
And this allows to e.g. compare a QString against a String literal or do
something like
QString myString = "This is a test";
which we know to be unproblematic.

Note however that (quote from Qt's docs)
"Using this macro together with source strings outside the 7-bit range,
non-literals, or literals with embedded NUL characters is undefined."
2020-08-31 09:59:05 +02:00
Robert Adam
9d244227aa
Merge pull request #4147: FEAT(server): Add rememberduration option
This option allows to set a threshold on how long a user's channel
should be remembered. This is useful for scenarios where users usually
don't want their channel to be remembered by the server unless they had
a disconnect (aka have ot re-connect after a short period of time).

Implements #4143
2020-07-08 19:21:27 +02:00
deluxghost
13b85a3ae2 FEAT(server): Add rememberduration option
This option allows to set a threshold on how long a user's channel
should be remembered. This is useful for scenarios where users usually
don't want their channel to be remembered by the server unless they had
a disconnect (aka have ot re-connect after a short period of time).

Implements #4143
2020-07-03 19:27:45 +02:00
Popkornium18
410837526c REFAC(server): replace NULL with nullptr
This changes all occurances of NULL in the murmur source
dir to nullptr. Additionally explicit comparisons with NULL were
removed.
2020-07-02 00:55:36 +02:00
Terry Geng
80a3108b59
src: Log failed resync attempts due to invalid key/nonce. 2020-06-06 20:38:11 +08:00
Terry Geng
e90eb8c4cd
src: Made CryptState an abstract class, in order to support multiple crypto types in the future. Moved all crypto-related files into src/crypto. 2020-06-06 20:37:59 +08:00
Alex Scorer
da3f5f54e2 ACL:Add new permission for Reset Comment/Avatar in server & client
This commit introduces a new permission, ResetUserContent, to grant the ability to reset another user's comment or avatar.
It also includes a check in the ACL editor window. If the server version is less than 1.4.0 then don't show the new permission in the ACL checkbox list as the server won't respond to it.
On older servers the Move permission in the root channel was also used for allowing or denying comment and avatar changes.
2020-06-02 23:25:23 +01:00
Robert Adam
e839bb2a9e src: Allow listener proxies in the same channel the actual user is in
Before you weren't able to place a listener proxy (ChannelListener) into
the same channel that you're currently in and if you joined a channel
that you were listening to before, your listener proxy would be removed
from that channel.

It was brought to my attention though that there are cases in which a
person wants to hear what's going on in several channels and thus places
listener proxies into them. However if that same person needs to
constantly hop between these listened channels (e.g. to talk to the
folks in there), it gets very annoying as that person constantly has to
think about re-adding the listener proxy into the channel it just left.
2020-05-04 17:54:16 +02:00
Robert Adam
650e18d79e src/murmur: Fix ChannelListener not hearing shout if no real user is in shouted channel
If you placed a listener proxy into an empty channel and someone was
shouting to that channel, you'd still not hear any of that. This is
because the old processing logic was injected into the code for the
normal shouting feature. However if there is no user in the channel, the
shouting feature won't do anything.

This commit added the listener targets as a separate entry in the
WhisperTargetCache in order for it to be processed independently of
normal shouts. It also had to tweak the logic for how and when to clean
the WhisperTargetCache in order for this to work nicely with
ChannelListeners as well.
2020-04-30 09:27:27 +02:00
Robert Adam
466479992d src/murmur/Messages.cpp: Restrict string sizes for Version information
Before this commit it was possible to pass more or less arbitrary sized
strings as part of the Version message. This could lead to malicious
clients sending huge strings as part of this message.
The problem arises once these Strings are displayed in the UI (e.g. once
a user selects Information from the context menu of such a malicious
client). Qt will then be so busy to render this String that it
completely freezes the UI (#4067).

This commit prevents this attack by restricting the size of the Version
strings on the server side. If a client sends strings that exceed this
size, the server will drop the original content and replace it with a
generic "[[Invalid]]".
2020-04-24 11:08:58 +02:00
Robert Adam
db465f0b42 src/murmur/Messages.cpp: Warn older clients about ChannelListener feature
ChannelListener will be introduced with Mumble 1.4.0 but older clients
will not know what these are. Thus they won't show them in their UI
which could lead to users being listened to without noticing.

In order to solve this issue, this commit implements a logic on the
Server that'll inform older clients about this possibility by sending
them a TextMessage right after they have authenticated (and after they
have received the server's welcome text).
2020-04-22 18:23:29 +02:00
Robert Adam
8aadee917d Feature: Channel Listeners
This implements #3319 by allowing users to "listen" to a channel they
have not joined. Doing so will place a "listener proxy" (in other
software this is sometimes known as a "phantom") in that channel which
will look like a normal user except that it'll have the same name as the
user listening to that channel and an ear-icon instead of the normal
avatar-icon. It will also always show a muted-icon next to it.

If a listener proxy is in a channel, the server will route all audio
packets from that channel to the user the proxy belongs to (as if that
user was in the channel). Note though that the opposite of this is not
true: The users in the channel will not hear audio from the listening
user unless that user decides to join the channel.

Furthermore it is possible to set a local volume adjustment for each
individual proxy that will be applied to all audio that is received
through it.
2020-04-16 09:29:49 +02:00
Daniel Lublin
dd748d640d src/murmur/Messages.cpp: Log also the OSVersion that has been extracted 2020-04-04 17:10:22 +02:00
Robert Adam
d45e7e0796 Murmur-Feature: Ability to log ACL and/or group changes
As requested in #2481, this commit introduces the option to print
changes of ACLs and/or groups to the server-log. These logs then contain
the ALCs/groups before the change and after it and should thereby grant
all information necessary to debug what is going on with them.
2020-03-29 19:47:14 +02:00
Robert Adam
5a4f5297a3
Merge pull request #3929: Improve channel password handling 2020-02-28 19:18:48 +01:00
Robert Adam
69fe7c6909 Protocol: Added fields 'is_enter_restricted' and 'can_enter' to the ChannelState message in order for the protocol to be able to tell clients about which channels they will be able to enter 2020-02-28 18:41:00 +01:00
Robert Adam
84735650d5
Merge pull request #3978: Fixups for #3927 2020-02-27 18:30:22 +01:00
Robert Adam
b0270e0562
Merge pull request #3958: Replace deprecated constructs 2020-02-27 17:03:04 +01:00
Robert Adam
2fe853b042 murmur/Messages.cpp: Use const reference in foreach loop 2020-02-27 16:04:24 +01:00
Robert Adam
cb00b828e1 murmur/Messages.cpp: Formatted class-member initializer list 2020-02-27 16:04:00 +01:00
Robert Adam
f53d935312 murmur/Messages.cpp: Added periods to the end of sentences in comments 2020-02-27 15:53:26 +01:00
Robert Adam
c6a0984383 Qt: Adapted to use range-based constructors for lists/vectors/sets for
Qt 5.14 and higher

Qt 5.14 introduces a bunch of range-based constructors for the various
collection-classes that are now to be preferred over the generic
toList(), toSet(), toXY() functions
2020-02-27 15:29:48 +01:00
Robert Adam
85d793eece ProtoBuf: Replaced ByteSize() with ByteSizeLong() for Protobuf 3.4 and
higher
2020-02-27 15:26:45 +01:00
Robert Adam
8bb5cafcac Merge PR #3927: Added support for temporary access tokens 2020-02-08 14:02:29 +01:00
Davide Beatrici
4e67a2fafb Auto-update LICENSE.header in source files 2020-01-07 03:09:22 +01:00
Robert Adam
6bc6c9e822 src/murmur/Messages.cpp: Take case-sensitivity into account for temporary access tokens 2020-01-02 13:16:08 +01:00
Robert Adam
1c38b53fdf AccessTokens: Added support for temporary access tokens in the UserState message 2019-12-28 12:22:37 +01:00
Davide Beatrici
efb3c83512 Fix dangling else warning in Server::msgACL()
This commit fixes a warning encountered today on FreeBSD, probably because Clang was updated and now `-Wdangling-else` is enabled by default.

Messages.cpp:1330:5: error: add explicit braces to avoid dangling else [-Werror,-Wdangling-else]
                                foreach(int id, pg->members()) {
                                ^
2019-10-07 08:49:47 +02:00
Davide Beatrici
15831dbca8 Add missing includes for "no-pch" build
This commit adds all the missing includes when the PCH header is not used.

Also, some includes are reordered and/or made consistent (e.g. "#include <QtEndian>" -> "#include <QtCore/QtEndian>").
2019-09-12 22:08:39 +02:00
Davide Beatrici
5a07244a44 Don't include PCH headers directly
According to Qt's documentation the PCH header doesn't need to be included.

From https://doc.qt.io/qt-5/qmake-precompiledheaders.html:

"To make your project use precompiled headers, you only need to define the PRECOMPILED_HEADER variable in your project file."

"qmake will handle the rest, to ensure the creation and use of the precompiled header file. You do not need to include the precompiled header file in HEADERS, as qmake will do this if the configuration supports precompiled headers."
2019-09-12 00:13:35 +02:00
Davide Beatrici
b427333257 Auto-update LICENSE.header in source files 2019-01-25 04:56:19 +01:00
Davide Beatrici
3edc46ff73 Murmur: fix Denial of Service vulnerability in msgChannelState()
The vulnerability was kindly reported by the "zom.bi" (https://zom.bi) community, who also provided a patch, which is applied in this commit.

Thank you very much for your support!
2019-01-25 03:20:20 +01:00
MadMaurice
0daec57f5c Prevent instability and crash due to message flood
This patch adds a rate limiting to selected patches. The underlying rate limiter
used is the Leaky-Bucket algorithm. It allows for a burst of messages, but
limits them after a specified amount of messages within a time frame.
2018-08-30 19:53:05 +02:00
Stefan Hacker
5b034be575 Accept incompatibility with other 1.3 pre-release snapshots
Those now only say permission denied without a proper
reason.
2018-06-15 00:19:52 +02:00
Stefan Hacker
46cd35c847 Fix typo 2018-06-14 01:06:00 +02:00
Stefan Hacker
9e0526c485 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.
2018-06-14 00:50:50 +02:00
Mikkel Krautz
f6ba3a52bf Auto-update LICENSE.header in source files. 2018-01-01 23:05:37 +01:00
Mikkel Krautz
4d256ca675 CryptState: introduce AES_KEY_SIZE_* constants.
This change modifies CryptState to use AES_KEY_SIZE_BYTES and
AES_KEY_SIZE_BITS constants instead of using AES_BLOCK_SIZE.

This cleans up the code, making it easier to read and understand.
The key size is a distinct concept from the block size, even though
Mumble only offiiclaly supports OCB-AES128.

This also allows users of custom builds to bump their key size to
256-bit, if they desire. Of course, such builds will not be compatible
with any existing Mumble server, because neither Mumble nor Murmur
currently supports negotiating the crypto mode used for voice packets.
2017-01-20 00:04:07 +01:00
Mikkel Krautz
91ebb8b0b5 Update tree copyrights to 2017. 2017-01-08 21:05:57 +01:00
Kissaki
628ddc3a3e Remove most of channel name restriction
The server has a regular expression setting for channel names.
The additional restriction of having a word character is probably
reasonable for most users.
However, it is an arbitrary limitation that users may want to circumvent.
For example: A channel could not be named with hyphens only "---".

As this is an arbitrary and invisible limitation, whichs use case is
covered by the channelname setting (with a default, and adjustable by the
user) remove it.

We still prevent 0-length channel names as a special case, as they could
lead to issues in existing code paths (even when they should not with
consistently correct implementation).
2016-11-02 22:18:27 +01:00
Mikkel Krautz
cf6a5b7088 Hold write lock on qrwlVoiceThread when writing to bDeaf, bMute and bSuppress. 2016-06-24 00:03:12 +02:00