Commit Graph

225 Commits

Author SHA1 Message Date
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
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
af7dac72f4 FORMAT: Run clang-format 10 on all C/CXX source-files 2020-09-11 18:29:33 +02:00
Lartza
1c81b0adb9 FIX(server): Reorder old table drops based on constraints
This fixes the second case of PostgreSQL migration failure in #4292
2020-07-17 11:41:50 +03: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
Robert Adam
25febac815
Merge pull request #4105: Use REPLACE instead of INSERT
In #3803 it is reported that the server regularly crashes because the
MySQL/SQLite part of the database code for group changes doesn't handle
conflicts in primary keys (as the PostgreSQL part does).

This commit makes the SQL statement use REPLACE INTO instead of INSERT
INTO which according to the docs "REPLACE works exactly like INSERT,
except that if an old row in the table has the same value as a new row
for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the
new row is inserted."

It's actually a MySQL extension but according to Wikipedia SQLite
supports it as well.
2020-06-05 12:07:26 +02:00
Robert Adam
acdb31654d src/murmur/ServerDB.cpp: Fix DB structure version not getting updated on table update
In a scenario in which a database with an older structure version
already exists this would lead to the server re-generating all tables on
every start due to the version number not being updated in the process.
2020-06-02 08:34:48 +02:00
Robert Adam
9768cc70d4 src/murmur/ServerDB: Make sure the Database uses proper encoding
In #4213 it was reported that connecting to a server with a unicode
character (Emoji) in the name can crash the server (provided the user
name passes validation which is only possible if the server uses a
special rule for the username config) when using MySQL as the backend.

This is because we have been using "utf8" for MySQL which - as it turns
out - isn't actual utf8 (https://mathiasbynens.be/notes/mysql-utf8mb4).

Therefore this commit changes this behavior by setting the proper utf8
encoding for MySQL databases. For SQLite and PostgreSQL the encoding is
checked and if it is not utf8 (or utf16), the server will refuse to
start. This is because there is no way to set the encoding for existing
databases for these backends.
2020-05-29 19:21:48 +02:00
Robert Adam
c4c358cc7a src/murmur/ServerDB: Turned db version into static field & added some documentation to init/update process 2020-05-29 13:02:37 +02:00
Robert Adam
615448f304 src/murmur/ServerDB.cpp: Use REPLACE instead of INSERT
In #3803 it is reported that the server regularly crashes because the
MySQL/SQLite part of the database code for group changes doesn't handle
conflicts in primary keys (as the PostgreSQL part does).

This commit makes the SQL statement use REPLACE INTO instead of INSERT
INTO which according to the docs "REPLACE works exactly like INSERT,
except that if an old row in the table has the same value as a new row
for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the
new row is inserted."

It's actually a MySQL extension but according to Wikipedia SQLite
supports it as well.
2020-05-27 18:53:30 +02:00
deluxghost
6e08d23db9
src/murmur/ServerDB.cpp: fix sqlite version requirement 2020-05-12 15:27:55 +08:00
Davide Beatrici
4e67a2fafb Auto-update LICENSE.header in source files 2020-01-07 03:09:22 +01: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
Thomas Ross
e95617a634 Fix transaction handling in Server::registerUser 2019-04-02 19:49:43 -04:00
Alexis Jeandeau
afa9f83989 Fix typos in ServerDB::loadOrSetupMetaPKBDF2IterationsCount 2019-03-25 22:32:04 +09:00
Alexis Jeandeau
f66a8d58ca Remove unnecessary spaces in the logs when setting up the PBKDF2 iteration count 2019-03-25 22:29:54 +09:00
Davide Beatrici
b427333257 Auto-update LICENSE.header in source files 2019-01-25 04:56:19 +01:00
Lorenz Brun
e5aadf295d Don't drop indices, this breaks the upgrade process 2018-12-15 17:56:37 +01:00
Mikkel Krautz
f6ba3a52bf Auto-update LICENSE.header in source files. 2018-01-01 23:05:37 +01:00
lewisca04
5669cf15ce Added fix for murmur check for MySQL, SQLite, and Postgres 2017-04-21 14:37:57 -04:00
Mikkel Krautz
1818476399 ServerDB, Meta: add support for SQLite WAL.
Using SQLite's WAL (write-ahead log) can create less disk I/O while
still providing good consistency and durability.

This change uses SQLite's WAL with synchronous=NORMAL which can
cause loss of transactions on power failure. Only the transactions
which haven't been synced to the disk by the OS are lost. The
database itself will still be in a consistent state, but it might
not have all recent changes.
2017-03-05 22:42:57 +01:00
Mikkel Krautz
218eb18b3a ServerDB: use PasswordGenerator class for generating initial SuperUser password.
This replaces our ad-hoc password generator in ServerDB for generating
the initial SuperUser password.

The original implementation had several problems, including use of a
non-cryptographically secure random number generator, as well as problems
with modulo bias.
2017-03-02 01:32:46 +01:00
Mikkel Krautz
91ebb8b0b5 Update tree copyrights to 2017. 2017-01-08 21:05:57 +01:00
Mikkel Krautz
175ddb608a ServerDB: ensure 'id' is never uninitialized in Server::removeChannelDB().
This commit fixes a potentially uninitialized variable ('id') in
Server::removeChannelDB().

GCC warning was:

ServerDB.cpp: In member function void Server::updateChannel(const Channel*):
ServerDB.cpp:1655: warning: id may be used uninitialized in this function
2016-11-13 23:42:55 +01:00
Luke A Pitt
1c12c8172e Replace checks for (not SQLite and not PostgreSQL) with checks for MySQL. 2016-08-31 15:17:23 +01:00
Luke A Pitt
477f335ed7 Whitespace fixes. 2016-08-30 22:50:38 +01:00
Luke A Pitt
64d09ce472 This commit removes the reconnection logic from ServerDB::query().
Logic was removed due to issues raised in comment https://github.com/mumble-voip/mumble/pull/2383#issuecomment-230173429 .
2016-08-30 22:44:55 +01:00
Luke A Pitt
7560db024d Use UPSERT for PostgreSQL, REPLACE INTO for other databases.
Used place holder marks for PostgreSQL UPSERT values instead of positional binding since the statements require the values twice (once for the INSERT, and once for the UPDATE should the insert fail).
The values to use for the ON CONFLICT DO UPDATE part of the UPSERT have been prefixed with u_ .

This commit reverts to using REPLACE INTO for non-PostgreSQL databases and uses the same code for them as the upstream master mumble-voip/mumble.
Previously this branch used the same code for all databases. This commit uses if statements to treat PostgreSQL differently from other databases where it needs to use UPSERT instead of REPLACE INTO.
2016-08-30 22:42:58 +01:00
Luke A Pitt
8f20669b06 Minimum changes to make previously applied postgresql pacth work with current version of mumur.
Change users table to have new column format.
Change slog table to have a default value of "now()" for column msgtime as other databases use triggers to add this value.
Revert database logging statement so that the timestamp is assigned by triggers or column default values.
2016-08-30 22:25:40 +01:00
Luke A Pitt
3d5c74307a Indentation fix - Replace spaces with tabs. 2016-08-30 22:17:07 +01:00
Arne Fenske
b99a4596f1 Murmur now supports PostgreSQL. The PostgreSQL plugin for Qt 4 ('libqt4-sql-psql' package in Debian) is required. To enable this feature, use the 'dbDriver=QPSQL' option in your 'mumble-server.ini'. 2016-08-30 21:56:13 +01:00
Mikkel Krautz
f260bd1913 Implement correct write locking for addChannel/removeChannel/link/unlink. 2016-06-24 00:03:11 +02:00
Frank Engler
fd24ee94a9 ServerDB.cpp: refactor code writing SuperUser password into DB
setSUPW and disableSU used same code to write into database.
This duplication is removed and replaced with private function
writeSUPW.
2016-05-22 03:01:06 +02:00
Frank Engler
16f7323a15 murmurd: command line argument "-disablesu" disables SuperUser
Password login was always allowed for SuperUser. -disablesu
removes SuperUser password. Certificate based authentication
is never allowed for SuperUser. In consequence SuperUser can
authenticate neither with password nor with certificate.
Set new password to allow login for SuperUser again.
2016-05-22 03:01:06 +02:00
Mikkel Krautz
54c28d3ee1 src/murmur: update to use LICENSE.header. 2016-05-10 22:42:02 +02:00
Tim Cooper
c0879e57bf Allow creating channel with a set maximum number of users
Fixes mumble-voip/mumble#1913
2015-11-22 17:31:21 +01:00
Tim Cooper
84b1bcecef Add per-channel user limit 2015-11-22 14:17:39 +01:00
Stefan Hacker
c664b98943 Fix more coding guideline violations. 2014-10-21 23:44:33 +02:00
Stefan Hacker
8aa125fbc7 Fix issues found in review of PR #1422 2014-10-21 02:33:05 +02:00
Stefan Hacker
5131d9e303 Review and refactor of PBKDF2 support patch.
* Adjusted to coding guidelines
* Pulled out PBKDF2 functionality into own class
* Make benchmark a best of N approach with guaranteed minimum
* Fixed broken database migration code. Don't try to alter
  tables and instead rely on them being re-created with the
  new fields.
* Fixed some typos in ini. Also move to the setting to the
  end so ppl. don't get the idea they have to change this.
* Chose a scarier name for the plain hash function
* Use int instead of size_t for iteration counts as it is
  the datatype used in the OpenSSL API. Otherwise we just
  have to much pain with constantly converting and might
  expose ourselves to size issues in the future.
* Moved new UserInfo enum entry to the end as to preserve
  the order
2014-10-03 01:19:29 +02:00
tkmorris
813aceb854 Add PBKDF2 support to Murmur. 2014-10-02 23:23:31 +02:00
main()
dc3b78c914 Add "forceExternalAuth" config option to Murmur
Without this option (or when it's set to false), Murmur's default
authentication will kick in when your external authenticator plugin
crashes and basically allow *anyone* to login and register.

When it's enabled, Murmur will instead return a temporary login
failure to the client.
2014-07-17 20:55:44 +02:00
Kissaki
cdcf77c06b Adjust method comment to match usage
* The ice authenticator API was changed to allow returning -3 on auths,
the method comment of Server::authenticate now reflects this change as well.
** See 88d41e10, 6e8c8939
* The surrounding code already checks for the return value -3
(caller of method Server::msgAuthenticate)
2014-07-14 18:11:32 +02:00
Kissaki
ef8b3b99f5 Userlist improvements: Use QDateTime.
* Use QDateTime wherever possible.
* Code refactoring
2013-06-28 23:57:23 +02:00
Kissaki
b951fc352b Userlist Improvements: Use RPC callbacks as well.
* Make getRegisteredUsersEx use RPC callbacks
* Implement UserInfo constructors
2013-06-28 22:02:48 +02:00
Zuko
b3aac5e0f5 UserList improvements 2013-06-23 20:38:58 +02:00
Kissaki
676bb0e312 use qFatal instead of exception
* split / taken from commit d6a572
2013-06-05 00:22:56 +02:00