Commit Graph

311 Commits

Author SHA1 Message Date
Robert Adam
7271bcaf05 FIX(server): Respect Qt's desired initialization order
In a Qt application, the QApplication object should be the first QObject
that is created. However, the `Meta` class used to have a static member
called `mp`, which means that this member gets initialized _before_
main() runs and therefore before the QApplication is created.

This has caused an "Invalid nullptr in QObject::connect" warning
somewhere in Qt's internals (since the move to Qt 6). The impact of this
warning is unclear at this point.

This commit makes the mp parameter a std::unique_ptr that gets
explicitly initialized in the main function (more or less right after
the QApplication object is created). This guarantees that the MetaParams
object does not get created before the QApplication object, fixing the
observed warning.

It is worth noting that we do have a couple of other static QObject
variables in the main translation unit, but these seem to be
inconsequential (at least they don't seem to trigger a similar warning).

Fixes #6669
2025-01-11 17:56:39 +01:00
Hartmnt
e64f334c93
Merge PR #6512: FIX(server, client): Fix ACL write and traverse permissions 2025-01-02 11:57:20 +00:00
Konstantin Goncharik
759339de9c
FIX(server): Fix build with Qt 6.8 2024-11-06 14:29:54 +07:00
Hartmnt
1e05f14f5b FIX(server, client): Remove "Write" ACL parent channel inheritance
Since 2a9dcfde4e and 62b1536fe0 the Mumble server
would overwrite the current channel Write ACL, if the user
had Write ACL permission in the parent channel.
Supposedly, this was done because otherwise malicious users
could create temporary "ungovernable" channels by locking admins out
denying Write ACL for them.
However, this makes ACL management a lot less intuitive with regard
to the Write permission.

This commit reverts those commits and instead adds a check to see
if the user has Write permission in the root channel instead.
The reasoning being: If the server owner grants Write ACL on root,
they probably want those users to be able to moderate every channel.
If instead the server owner only grants Write on part of the channel
tree, normal ACL rules apply and users may lock other users out for
whatever reason.
2024-10-14 17:25:22 +00:00
Robert Adam
c9eff88db0 REFAC: Remove code specific to non-supported Qt versions
This has been done under the assumption that we require at least Qt 6.2
2024-10-03 18:40:56 +02:00
Robert Adam
fbe0f9065a BREAK(server): Remove DBus support
The DBus RPC interface on the server has been deprecated for a while and
has also not been maintained for even longer. Therefore, the API has now
been removed completely.

Instead, users shall make use of the ZeroC Ice interface as a means to
do RPC.

Fixes #6548
2024-09-30 19:18:40 +02:00
Robert Adam
330c356e71 MAINT: Remove copyright year from all copyright notices
Keeping these up-to-date is just super tedious and they don't really
fulfill any purpose these days.
2024-09-30 18:06:20 +02:00
Hartmnt
f9593b8622 FIX(server): Allow to move temporary channels provided sufficient permissions
Previously it was not possible to move temporary channels at all.
This appears to be not deliberate as the move failed with a
"denied MakeChannel" message. Most likely, this is due to an
oversight in efbba85c60 where temporary channel movement
was simply not considered.

This commit fixes the ACL check to look for MakeTempChannel instead
of MakeChannel when appropriate.

Fixes #1162
2024-06-05 16:49:21 +00:00
Robert Adam
b7a46b20ab REFAC(server): Refactor WhisperTarget struct
Switch to using an unsigned integer as channel ID and rename member
variables to no longer include their type as part of the name (and make
names more meaningful in general).

Additionally, some Qt containers were replaced with std ones.
2024-04-06 16:58:02 +02:00
Hartmnt
19e55daabb FIX(server): Allow unregistered users to transmit access tokens
In 635d71960f cache invalidation for access tokens was added.
A check for ``uSource->iId >= 0`` was added which was intended
to only parse access tokens, if the ``authenticate`` method was
not returning an error code.

As it turns out though, ``uSource->iId`` will be -1 for unREGISTERED
users instead of unAUTHENTICATED users which lead to a bug
where unregistered users would not have the correct channel access
when connecting to the server. A subsequent update of their tokens
would fix that.

This commit moves the respective code block down and changes the
condition to ``ok``, which should now behave as originally intended.

Fixes #6334
2024-02-13 14:50:16 +00:00
Robert Adam
b5a67c05fb REFAC: Fix tons of warnings and non-portable code
In various places we relied on compiler extensions such as
variable-length arrays on the stack or using non-standard escape
sequences. In order to make our code as portable as possible, these
parts of the code have been refactored to only use standard C++.

Furthermore, the new warning settings triggered a bunch of new warnings
all over the place that have been addressed by this commit.
2024-01-07 17:10:11 +01:00
Robert Adam
e99c7c815d MAINT: Update Tracy to v0.9.1 2023-04-18 18:39:42 +02:00
Hartmnt
635d71960f FIX(server): Add ACL cache invalidation after user id is set
The ACL for group 'auth' depends on the user (db) id.
Previously, code paths using checks for 'auth' ACLs in msgAuthenticate
would not work correctly, because the ACL cache still contained
a state where the id was not set.

This commit adds cache invalidation after the user id is set, allowing
to correctly apply the 'auth' ACL in later parts of msgAuthenticate.
It also overhauls the general control flow regarding tokens and ACL
cache.

Fixes #5907
2023-04-01 12:23:38 +02:00
Robert Adam
8f47e18e76 FIX(server): Send enter restriction updates to correct user
Instead of flooding the client that issued the ACL change with messages
about other user's enter capabilities of the modified channel, we now
send those messages to the clients that actually care about this
information (the information affecting themselves).
2023-02-14 17:54:35 +01:00
Robert Adam
19696d6ca0 FIX(server): Potential crash due to missing locks
Not taking the qmCache mutex while accessing acCache can lead to
concurrent modification errors, that can cause the server to crash.
Therefore, we now make sure that we hold the mutex before accessing
acCache.

We re-take the lock in every iteration in order to ensure the voice
thread is not stalled by bigger loops over channel or users (the
voice-thread needs to take permissions into account for e.g. linked
channels). For this, we accept the overhead of re-taking the lock in
every iteration in the control thread.
2023-02-14 17:54:04 +01:00
Robert Adam
249d2c6298 MAINT: Update copyright headers to 2023 2023-01-08 15:54:35 +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
253f4b1a90 FIX(server): Fix temp channel permission check logic
Previously in 52e27ef37f a check was implemented to prevent users
in temporary channels from applying mute/deaf/priority speaker.
The reason for this being that temporary channels could, in theory,
be used to circumvent admin mutes.
This check was implemented by testing the channel of the _source user_
for the temporary flag.
This approach is flawed, because it prevents all users (including
admins) in any temporary channel from using these options. (Issue #1877)

This commit introduces a new approach which checks the first
non-temporary parent channel of the target for the MuteDeaf ACL.
It also allows the priority speaker to be set in temporary channels,
because a previous commit added the automatic priority speaker
clearing on switching channels.

The new approach should behave the same as before for mute/deaf
except that priviledged users can now mute/deaf others from
temporary channels (if they have the permission in the channel
above the temporary channel).

Fixes #1877
Partly touches #3584
2022-10-12 16:30:22 +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
7d4dcd168d REFAC(server): Removed dead code msgUDPTunnel
This message type is explicitly handled before calling into the
different msg* implementations. Therefore, msgUDPTunnel could never be
called in the current state of the code base.

However, we can't remove the implementation completely, because of the
macro voodoo that is used to declare and switch over the different
message types (we can't remove the entry from the macro, since in there
we still need it for defining the respective enum entry).
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
2828e46ffc REFAC(server): Improve semantics in msgUserState
Inside Server::msgUserState there are a couple of places that implement
the functionality of a client making modifications to itself (e.g.
self-mute). In these cases, uSource == pDstServerUser. Therefore
functionality-wise, it doesn't matter which of these variables the
implementation uses. However, there is a semantic differences and as
such this commit refactors these code parts to perform the actions on
pDstServerUser instead of uSource in order to make clear that
pDstServerUser is always the user to whom the action is applied.
2021-12-08 18:23:43 +01:00
Robert Adam
bdbc6d8970 CHANGE: Make joining root channel explicit
When joining a server, a client is placed in the root channel by
default. However, this placement was implicit as the server would
explicitly exclude this information to be broadcast with the sent
UserState message.

In order to facilitate external applications to get this all right, this
commit now makes sure that this information is shared explicitly (just
as if the user would be placed in a different channel because the server
remembered their last channel).

Note: This commit also adapts the client code to only move the user if
the specified channel is not its current channel already, but even
without this change, the client code will handle the additional
information gracefully.

Fixes #5270
2021-11-21 16:46:05 +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
Robert Adam
252302b514 FIX(server): uiSession being used before assignment
In eabfbab403 the assignment of the
uiSession variable of any given client was delayed into the
Server::msgAuthenticated function in order to prevent non-Mumble
connections to be counted as users.

However the assignment of the session ID was moved so far down that
there is now previous code that already depends on its value and is now
using an uninitialized (or at least wrong) value for the session ID.

This commit fixes this by assigning the session ID very early in the
Server::msgAuthenticated function, making sure that the code before it
does not reference the session ID already.

This bug could have had all kinds of side-effects but one of them was
that users were always presented with the "Unable to find matching CELT
codecs with other clients." message upon connecting to the server.

Fixes #5051
2021-06-11 21:08:45 +02: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
90190bcb01 CHANGE(server): Always trim usernames
A username will now always be trimmed before it gets assigned to a user.
That means that names with leading and/or trailing whitespace are now no
longer possible.
2021-04-11 13:23:12 +02: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
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