Commit Graph

401 Commits

Author SHA1 Message Date
Robert Adam
e99c7c815d MAINT: Update Tracy to v0.9.1 2023-04-18 18:39:42 +02:00
Robert Adam
249d2c6298 MAINT: Update copyright headers to 2023 2023-01-08 15:54:35 +01:00
Robert Adam
18322e6db6 REFAC(server): Improve readability of Group::isMember
And while we're at it, give it a different name that better describes
what this function is actually doing (spoiler: it is not only checking
whether the given user is part of the specified group).
2022-12-15 20:09:17 +01:00
Robert Adam
9672f7bb7e
Merge PR #5925: Priority speakers and temporary channels
This MR contains two changes:

1. Clear the priority speaker flag on channel switch

2. The priority speaker should either be saved/loaded or cleared when a user enters/leaves a channel #5334)
Change how the temporary channel mute/deaf permission check is performed. Also: Allow priority speaker in temporary channels.

Fixes #5334
Fixes #1877
2022-11-28 14:10:28 +01:00
Martin Varga
68c31e5f9b FEAT(server): Flag bot connections
This commit introduces a new flag that connecting clients can use to
tell the server they are connecting to that they consider themselves bot
clients. This information can then be used (as is the case for the
official server implementation) to e.g. correct the reported user count
on the server to only include "real" clients - aka: no bots.

Fixes #5461
2022-11-27 18:46:12 +01:00
Hartmnt
8cf1665679 CHANGE(server): Clear priority speaker flag when switching channels
It is assumed that in most cases the priority speaker flag behavior
should be changed such that it is automatically cleared by the server
once a client switches channels.

This will also prevent malicious clients from giving themselves the
priority speaker flag in a temporary channel and then using that flag
in other channels to annoy users.

Fixes #5334
Partly touches #3584
2022-10-12 16:03:26 +00:00
Robert Adam
3f4b00a425 FEAT: Make channel listeners persistent on server
For registered users, the server will now remember their channel
listeners (and their volume adjustments) and will restore them once the
user rejoins this server.
2022-09-12 12:42:01 +02:00
Hartmnt
bacb371f83 REFAC(client, server): Rename uiVersion to m_version
Renames the internal version member variables from "uiVersion"
to "m_version"
2022-09-08 10:47:39 +02:00
Hartmnt
79762ce55e FIX(client, server): Fix patch versions > 255
Previously, the Mumble version was encoded with a uint32
in the network protocol reserving 2 bytes for the major
component and 1 byte for each minor and patch.
The versioning format was changed to include a build
number in the patch field. With a recent update (1.4.274)
the patch field exceeded 255 for the first time and broke
the protocol version.

This commit completely reworks how the version is stored
internally and transfered with the network protocol.
The new version is a uint64 and consists of 4 fields with
2 bytes each. This allows each version component to reach
up to 65535. Furthermore, all instances of integer version
types have been replaced with the alias Version::full_t for
a better abstraction. Version literals have been replaced by
Version::fromComponents calls.

Fixes #5827
2022-09-08 10:45:47 +02:00
Robert Adam
ec351900fe
Merge PR #5769: FIX(server): Update suppress state on ACL change
The suppress state of a user represents whether the user is currently in
a channel in which they don't have the Speak ACL. As of now this state
is only updated whenever the user switches channel.

However, the suppress state should also change, if the ACL for a given
channel change. This is what the current commit does. If this is not
done, a user will be able to continue speaking in a channel where they
should not be able to and only if they leave and re-join the channel
will the new ACL take effect.

To avoid such a situation, the current code updates the suppress state
every time the ACL change.

Fixes #5264
2022-08-01 07:19:38 +02:00
Robert Adam
83d1e311c9 FIX(server): Update suppress state on ACL change
The suppress state of a user represents whether the user is currently in
a channel in which they don't have the Speak ACL. As of now this state
is only updated whenever the user switches channel.

However, the suppress state should also change, if the ACL for a given
channel change. This is what the current commit does. If this is not
done, a user will be able to continue speaking in a channel where they
should not be able to and only if they leave and re-join the channel
will the new ACL take effect.

To avoid such a situation, the current code updates the suppress state
every time the ACL change.

Fixes #5264
2022-07-31 20:52:19 +02:00
Robert Adam
fa3b8c38bd FIX(server): Don't ignore explicit PermissionQuery
7439bc4fe6 introduced the ability for
clients to query for their permissions in any given channel. Since that
commit also added an automatic permissions broadcast for channels that a
client enters (and also its parent channel), it also introduced a
system to keep track of whether a given permission set has already been
broadcast to a given client. Supposedly this was meant as to not flood
the client with PermissionQuery messages if it just keeps switching
between the same channels (and thus already knows about the respective
permissions after having joined a channel for the first time).

Oddly enough though, when a client explicitly requests to be informed
about a channel's permissions, the cache would also be consolidated and
if the server was under the impression that the client already knows
about these permissions, its explicit query would simply be ignored.

This is of course nonsense, since ultimately it is the client who knows
whether it wants to be informed about those permissions (again) or not.

Therefore, this commit ensures that explicit queries are always
answered. No need to consolidate the cache and decide on whether the
server feels like answering or not.

Fixes #5699
2022-07-31 20:49:14 +02:00
Robert Adam
928513d689 REFAC: Consistently format constexpr VAR_NAMES 2022-03-27 09:49:59 +02:00
Robert Adam
c21e16c25c FEAT: Add profiling support for audio processing
This should allow to get detailed insights into the audio processing
performance when using the Tracy profiler.
2022-03-27 09:49:59 +02:00
Robert Adam
1d45d991aa CHANGE: Use Protobuf for UDP messages
Previously Mumble was using a custom binary format for transmitting data
via UDP (mainly audio). This has worked for a long time but besides
being inconvenient for 3rdParty implementors (they had to manually
re-implement encoding and decoding support for this format) this format
was not very flexible and changes to the data format were very hard.

In order to improve on this situation, this commit introduces changes
that allow to use Protobuf for the UDP messages as well (it's already
used for TCP). With that it should be relatively easy to extend/change
the UDP packet formats in the future and 3rdParty implementors can now
simply use Protobuf to handle decoding/encoding packets for them (much
less work and much less prone to errors).

Since the new Protobuf format is incompatible with the old UDP format,
this commit also includes support for dealing with older clients or
servers that don't recognize the new protocol yet. That way the new
protocol format is only used if both the client and the server are
recent enough to have it implemented (assumed to be the case >=1.5.0).

Note also that the server will make sure that clients using the old and
the new format can seamlessly communicate with one another.

Therefore, on the surface it should not be noticeable to the user which
protocol is currently used.

Note also that the new protocol format only supports Opus as an audio
codec. If one of the legacy codecs is to be used, the legacy packet
format has to be used as well. However, all codecs except for Opus will
be removed from Mumble in the future anyway.

Fixes #4350
2022-03-27 09:49:58 +02:00
Robert Adam
d100ff1467 MAINT: Update copyright to 2022 2022-01-04 20:17:33 +01:00
Robert Adam
dd56e174f2 FEAT(server): Add support for the tracy profiler
Tracy (https://github.com/wolfpld/tracy) is a profiler that is aimed at
having a very low impact on the runtime performance and is thus suitable
to be used in production systems to figure out what is going on and how
the code is performing.

For the time being, this commit instruments only the server code.
Furthermore, the instrumentation is performed in a rather minimalistic
way that should suffice to start profiling audio and control message
processing but is definitely far from being complete. Further
instrumentation will be added on-demand.
2021-12-29 18:01:28 +01:00
Robert Adam
5ca25ee498
Merge PR #5280: FIX(server,client): Validate/use the correct certificate from a chain
Currently, obtaining and validating the peer's certificate chain is a mess. While obtaining the chain (which is ordered, starting with the peer's immediate certificate and ending with the CA's certificate), the peers immediate certificate is added again, as last certificate. Then, while validating, the last certificate is checked. This approach works (since the validated certificate is the one that is expliticly added), but puts the whole concept of a ordered certificate chain to absurdity.

This commit fixes that. First, the chain it is returned unaltered in its original form (ordered and starting with the peer's immediate certificate and ending with the CA's certificate). Then, while validating, the first certificate in this chain is checked.
2021-11-10 19:38:12 +01:00
Eric Prokop
7d67da15ee FIX(server,client): Validate/use the correct certifiacte from a peers chain
Currently, obtaining and validating the peer's certificate chain is a mess. While obtaining the chain (which is ordered, starting with the peer's immediate certificate and ending with the CA's certificate), the peers immediate certificate is added again, as last certificate. Then, while validating, the last certificate is checked. This approach works (since the validated certificate is the one that is expliticly added), but puts the whole concept of a ordered certificate chain to absurdity.

This commit fixes that. First, the chain it is returned unaltered in its original form (ordered and starting with the peer's immediate certificate and ending with the CA's certificate). Then, while validating, the first certificate in this chain is checked.

Fixes #3523 (partially)
2021-11-10 17:18:24 +01:00
Robert Adam
8d857e8f2b FEAT(server): Add option to disallow recording
This commit adds a new server-configuration that can be used in the
murmur.ini file. It can be used to forbid anyone on the server from
using Mumble's built-in recording functionality.

Any client trying to start a recording nonetheless, will be kicked from
the server.

From Mumble 1.5.0 clients will know about this configuration and will
disable the recording action in the UI, if recording is not allowed on
the server.
2021-11-10 10:20:43 +01:00
WGH
4db7366d12 FIX(server): Always bind to both IPv6 and IPv4 by default
The check for configured network interfaces at startup has a problem
that if IPv4 is not configured for some reason, Mumble will bind to
IPv6-only socket, and will not be available over IPv4 until manually
restarted.

There's no harm binding to the "any" IPv6 address with IPV6_V6ONLY set
to 0 even if there're no assigned addresses of either address family.
The bind will succeed either way, and will accept connections on any
new address configured in the system regardless of the address family.

QHostAddress::Any tries to setup an AF_INET6 socket with IPV6_V6ONLY
set to 0, and falls back to AF_INET in case it's unavailable.
However, it will only happen if IPv6 is completely disabled on the
system, which is a rare configuration, but nevertheless it will fall
back gracefully.

Fixes #5208
2021-07-27 20:15:59 +03:00
Robert Adam
b6b79cc458 REFAC: Turn MumbleVersion into namespace
The "class" was only used as a namespace anyway. And while we're on it
the entire thing was renamed to "Version" instead of "MumbleVersion".
2021-06-03 16:13:36 +02:00
Robert Adam
ad5968cad4 FORMAT: Run clang-format 10 on all source files 2021-05-16 18:40:34 +02:00
Robert Adam
f518ad8018 FIX(server): ChannelListener IDs colliding across VServers
As the ChannelListener feature was implemented via a Singleton class,
there was only ever a single, global instance keeping track of listeners.
If however there were multiple VServers running from within a single
Mumble server instance, all of them would use the same ChannelListener
instance. That allowed for user-IDs to collide across different VServers
when it came to listener-management.

Thus listeners could appear/disappear seemingly at random whenever a
user on a different VServer (with the same session ID on that server)
changed their listeners.

Fixes #4366
2021-05-16 16:21:25 +02:00
Robert Adam
923045ac60 FORMAT: Run clang-format 10 on all source files 2021-04-16 21:05:52 +02:00
Robert Adam
27dbee8e62 FEAT(client): Plugin framework
This commit introduces a new plugin framework into the codebase of the
Mumble client. Note that "plugin" here really refers to a (more or less)
general purpose plugin and is therefore not to be confused with the
previously available positional data plugins (only responsible for
fetching positional data from a running game and passing that to
Mumble).

The plugin interface is written in C, removing the compiler-dependence
the old "plugins" had. Instead plugins can now be written in an
arbitrary language as long as that language is capable of being compiled
into a shared library and also being capable of being C-compatible.

As already indicated a plugin is essentially a shared library that
provides certain functions that allow Mumble to interface with it.

Inside Mumble the so-called PluginManager is responsible for managing
the plugins and relaying events to the respective callbacks. Plugins
themselves can also interact with Mumble on their own initiative by
using the provided API functions.

Fixes #2455
Fixes #2148
Fixes #1594
Fixes #2051
Fixes #3742
Fixes #4575
Fixes #4751
2021-04-16 20:15:44 +02:00
Robert Adam
c10d636cef
Merge PR #4922: MAINT: Update copyright notice to 2021 (Part II) 2021-04-13 15:10:50 +02:00
Robert Adam
58fee9705d CHANGE(server): Untrimmed usernames considered invalid
When checking whether a given username is valid, it being trimmed is now
also a criterion. All names with leading and/or trailing whitespace will
be considered invalid from now on.
2021-04-11 13:24:41 +02:00
Robert
56db3410c5 MAINT: Update copyright notice to 2021 (Part II)
Apparently the first commit (59ae429972)
did not include all files.

Furthermore the used script tended to produce funny results in certain
cases. This has been fixed and as a result thereof a few more changes
were made in this second run.
2021-04-09 15:41:49 +02:00
Davide Beatrici
604427ccdd
Merge PR #4885: REFAC(server): Replace non-standard u_char with uint8_t 2021-03-27 22:47:44 +01:00
Lorenz Brun
f70ebcccab REFAC(server): Replace non-standard u_char with uint8_t
u_char is an old nonstandard BSD alias and should
not be used in portable code.
2021-03-27 13:27:55 +01:00
qamodi
3f84a9a421 FIX(Server): Prevent multiple Sessions with ID 0
fixes bug introduced in eabfbab4

When an unauthenticated connection is terminated, the session ID still got enqueued into `qqIds`.
The session ID of unauthenticated clients is always 0 when it's not assigned. This means that
whenever an unauthenticated connection is terminated, 0 will be enqueued into `qqIds`. If this
happens multiple times, multiple clients will later be assigned session ID 0. All connections
with the same session ID are displayed as the same user for all clients. As a result of that
users might be listening to what you are saying in your channel without you noticing. If one
connection with session ID 0 gets terminated, all other connections with the same ID will
be terminated as well. This potentially enables denial of service.

Thanks to the Zom.bi community for fixing the bug.

Co-Authored-by: Madmaurice <madmaurice@zom.bi>
2021-03-27 02:19:49 +01:00
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
KetchupBomb
da26386827 FEAT(server): Remove broadcast of new welcometext when changing via Ice.
When changing the welcome text via Ice, Murmur would broadcast the new text to all connected clients. It is a matter of opinion if this is proper behavior or not, but it seems too proactive of an action. Let the clients see the new welcometext when they next connect, or let the Murmur administrator explicitly perfor a sendMessage() to all connected clients after changing the welcometext.

Closes: #4788

Co-Authored-By: Robert Adam <dev@robert-adam.de> <krzmbrzl@gmail.com>
Co-Authored-By: Robert Adam <dev@robert-adam.de> <krzmbrzl@users.noreply.github.com>
2021-02-25 22:16:26 +00:00
freddii
9889a0fa99 DOCS: fixed typos 2021-01-20 22:17:38 +01:00
Robert Adam
bbdfd10430 FIX(server): Prevent listeners from hearing all shouts
Before this commit, the code on the server made sure that a
ChannelListener would always receive audio that was being shouted to a
channel. It didn't respect though if the shout was actually restricted
to be received by only a specific group.

This patch now makes sure that listeners are also checked for their
group so that a listener that doesn't belong to the target group (if one
is set) won't receive the audio either.
2020-12-08 09:33:26 +01:00
Davide Beatrici
ee731f8405 FEAT(client, server): use native mDNS/DNS-SD API on Windows, if available
This allows:

- The client to find servers advertized via zeroconf without the need for Bonjour to be installed.
- The server to advertize itself via zeroconf without the need for Bonjour to be installed.

The Win32 API was introduced in the version 10.0.18362.0 (1903/19H1) of Windows SDK. Before that, only the UWP interface was available (introduced in Windows 10 1507).

This commit was successfully tested on Windows 10 1809, which probably means that the API can be used on previous versions as well.

Even if that isn't the case, it's not a problem: if the code fails to load the required symbols, it falls back to Bonjour.

"Q_OS_WIN64" is used instead of "Q_OS_WIN" because of an issue that appears when certain DNS functions are used in an x86 (32 bit) build: https://developercommunity.visualstudio.com/content/problem/1191345/some-dns-api-functions-cause-lnk2019-errors-in-32.html

This means that until the issue is fixed we can safely use the native mDNS-DNS-SD API only on x86_64 (64 bit).
2020-09-22 07:36:43 +02:00
Davide Beatrici
6a59ae2443 REFAC(client, server): replace "Bonjour" with "Zeroconf", except for 3rdparty
This should make it more clear that we don't include Bonjour-related stuff in our project. We use external libraries depending on the OS.

For compatibility, the server option is still called "bonjour". We should probably add a new option called "zeroconf" and then handle the old one if present in the configuration file.
2020-09-22 07:35:52 +02:00
Robert
b42100e129 REFAC: Fix warning about boost bind
Compiling with Boost a somewhat recent version of Boost would produce
warnings about deprecated usage of boost::bind.
These have been fixed now.

The warning was
The practice of declaring the Bind placeholders (_1, _2, ...) in the
global namespace is deprecated. Please use
<boost/bind/bind.hpp> + using namespace boost::placeholders, or
define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.

Fixes #4295
2020-09-12 13:46:55 +02:00
Robert
af7dac72f4 FORMAT: Run clang-format 10 on all C/CXX source-files 2020-09-11 18:29:33 +02:00
TredwellGit
e5c8c2a08c FIX(server): Use valid format string type
Format specifies type 'void *' but the argument has type 'QObject *'. Using an argument of an unexpected type is undefined behavior.
2020-09-02 15:58:03 -04: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
MadMaurice
b47e309f31 FIX(certificate): Retrieve QSslConfiguration after setting CA
Commit bdb12c6 added a regression for servers built with QT older than version
5.15. After this commit these servers do not serve intermediate certificates
anymore.  This happens because the QSslConfiguration is retrieved before adding
the CA certificates to the socket and is reinserted into the socket again after
adding the CA certificates, thereby overwriting the CA certificates added in
between.

This commit fixes that by retrieving the QSslConfiguration just after setting
the CA certificates in case an older QT version than 5.15 is used.
2020-08-11 23:06:25 +02:00
Robert Adam
0fbdbf13a4 FIX(server): Enforce max. packet size for UDPTunnel
Before this commit the packet size for packets sent through the
UDPTunnel was not checked for whether it exceeded the maximum allowed
size. This might open Mumble for attacks of some sort as the code
usually expects the packets to be of at most that size.
2020-08-02 17:15:57 +02:00
Robert Adam
28c3a62acf FIX(server): Don't allow poslen > len
This case can crash the server as the calculated buffer length without
positional data (which is the normal case) is negative (len - poslen).
2020-08-02 17:14:51 +02:00
Robert Adam
30b67b76eb
Merge pull request #4344: FEAT(server): Allow loading welcome text from file
This allows specifying welcometextfile in murmur.ini. If no welcometext
is set in the ini-file, the welcome text is loaded from the file.

Fixes #3723
2020-07-14 17:57:05 +02:00
Popkornium18
39e12d3325 FEAT(server): Allow loading welcome text from file
This allows specifying welcometextfile in murmur.ini. If no welcometext
is set in the ini-file, the welcome text is loaded from the file.

Fixes #3723
2020-07-08 20:10:32 +02:00