Commit Graph

202 Commits

Author SHA1 Message Date
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
Kissaki
487ed1471c Implement copy constructors, minor cleaning
* Implement copy constructors for classes with allocated memory.
** ServerDB gets a private not implemented copy constructor to effectively prevent copying, as it uses the static db field as a member.
* Fail hard on subsequent ServerDB instantiations
2013-06-04 22:37:34 +02:00
Benjamin Jemlich
c2b7c00e51 Murmur: Generate a random SuperUser password for new servers 2012-05-31 12:59:39 +02:00
Benjamin Jemlich
c17ca267d0 Murmur: Add workaround for databases that contain channel_info rows for channels that don't exist 2012-03-12 19:57:16 +01:00
Benjamin Jemlich
491cd1eb44 Misc fixes 2012-02-26 08:36:19 +01:00
Patrick Matthäi
5f79a1bab3 Unified spelling of of writable (s/writeable/writable) 2012-02-24 01:56:01 +01:00
Benjamin Jemlich
cc8e245c53 Mark Server::log as const 2012-01-14 22:47:32 +01:00
Benjamin Jemlich
07737a314c Fix include guards and PCH includes 2011-11-09 00:12:10 +01:00
Benjamin Jemlich
089b23d977 Fix ghost disconnect removing permissions (#3423985)
Returning a list of groups using an authenticator added
temporary group membership for the user id only. Those are
removed when we're disconnecting an old user using the same
user id. Adding the session id to the group should fix the
problem.

This won't work if someone uses verifyPassword to set the
permissions (which is an undocumented implementation detail
anyway).
2011-10-23 09:30:02 +02:00
Jamie Fraser
fa7a412e24 Added option -wipelogs to clear logs in DB. 2011-04-24 17:36:36 +02:00
Thorvald Natvig
f3437a6ba7 Update copyright year ranges of dev team. 2011-03-18 05:52:51 +01:00
Thorvald Natvig
e0ba3831b2 Work around timestamp update for mysql 2011-01-23 22:10:28 +01:00
Thorvald Natvig
53e5c75b26 Fix ID of new server if all servers deleted 2011-01-23 21:53:11 +01:00
Thorvald Natvig
35cba04250 Indent, changelog, submodule and language update 2011-01-08 22:36:50 +01:00
Thorvald Natvig
5bdf5254e8 Timestamp table upgrades 2010-12-27 15:42:58 +01:00
Benjamin Jemlich
03a86344eb Change MySQL table creation statements to work with 5.5.x 2010-12-24 00:55:45 +01:00
Thorvald Natvig
5dfd1f0cb3 Try to be slightly more tolerant of third-party tables in the DB 2010-11-28 07:10:41 +01:00
Jamie Fraser
71e90290cc Ice method: int getLogLen() 2010-08-28 16:51:05 +02:00
Jamie Fraser
85feea3b56 Added ability to disable logging to DB 2010-07-30 13:34:05 +02:00
Benjamin Jemlich
2997897f24 Fix some gcc and cppcheck warnings 2010-07-20 17:31:01 +02:00
Thorvald Natvig
470a0890f2 New servers have DB version 5 2010-07-14 17:36:28 +02:00
Thorvald Natvig
10cd5c5353 Indent, changelog, submodule and language update 2010-07-11 01:05:54 +02:00
Stefan Hacker
5c40cfeb4b Don't validate the name before we are sure it wasn't already validated by an authenticator 2010-06-29 23:41:03 +02:00
Benjamin Jemlich
6b33dda344 Don't crash on long usernames 2010-06-29 15:33:27 +02:00