Commit graph

444 commits

Author SHA1 Message Date
Learath 1073b72965 Ignore DNSBL on "empty" servers. 2018-10-08 01:59:07 +03:00
heinrich5991 a36250ba34 Use two threads for the server thread pool
This might help with long DNS timeouts.
2018-10-07 12:47:32 +02:00
Dennis Felsing a63f210a01 Fix segfault when deleting lock 2018-08-29 10:32:12 +02:00
Dennis Felsing c29a72eb70 Lock style 2018-08-27 16:36:36 +02:00
Dennis Felsing 4d634bb7fd Global lock for MySQL Connector's get_driver_instance
See note in https://dev.mysql.com/doc/connector-cpp/1.1/en/connector-cpp-examples-connecting.html

> get_mysql_driver_instance() calls get_driver_instance(), which is not
> thread-safe. Either avoid invoking these methods from within multiple
> threads at once, or surround the calls with a mutex to prevent
> simultaneous execution in multiple threads.
2018-08-27 09:42:37 +02:00
Dennis Felsing 03098af933 Fix dnsbl initialization
Don't set dnsbl state to pending when we someone connects over ipv6 and
the init will fail, leaving a null pointer in m_pDnsblLookup
2018-08-24 14:24:34 +02:00
heinrich5991 8d04e7e5e1 Share libcurl resources across requests
Use the libcurl-share interface to share DNS cache and connections
between different requests.

If compiled with OpenSSL, libcurl can only be safely used from multiple
threads for OpenSSL >= 1.1.0, but this problem is not newly introduced
by this commit: According to libcurl-thread(3):

>OpenSSL <= 1.0.2 the user must set callbacks.
>
>https://www.openssl.org/docs/man1.0.2/crypto/threads.html#DESCRIPTION
>
>https://curl.haxx.se/libcurl/c/opensslthreadlock.html
2018-07-11 20:17:21 +02:00
yangfl 81a39c229b Fix typo 2018-07-10 17:29:02 +08:00
heinrich5991 ca8fcc823c Use more secure hash function for map downloads
SHA256 was chosen because it is reasonably standard, the file names
don't explode in length (this rules out SHA512) and it is supported by
basically all versions of OpenSSL (this rules out SHA512/256 and SHA3).

The protocol is changed in a backward compatible way: The supporting
server sends the SHA256 corresponding to the map in the `MAP_DETAILS`
message prior to sending the `MAP_CHANGE` message. The client saves the
SHA256 obtained from the `MAP_DETAILS` message until the next
`MAP_CHANGE` message.

For servers not supporting this protocol, the client falls back to
simply opening maps like in the previous scheme.

Remove the `map_version` tool, it is not being used and would have been
a little bit effort to update.

Use the OpenSSL implementation of SHA256 if it is supported, otherwise
fall back to a public domain one.

Fix #1127.
2018-06-24 17:04:50 +02:00
heinrich5991 36694d3852 Add a way to call for external moderator help
This is done by HTTP POSTing to a location specified by
`sv_modhelp_url`. We also provide a `src/modhelp/server.py` which can
use theses POSTs to forward them to Discord servers.

The POST contains a JSON object payload, with the keys `"port"` which
contains the server port, `"player_id"` which contains the calling
player's client ID, `"player_name"` which contains the calling player's
nick and `"message"` which is the user-specified message.

Make JSON-escaping function public, add tests and fix bugs uncovered by
these tests.

Supersedes #1129.
2018-06-19 23:27:35 +02:00
heinrich5991 9454dfbff9 Remove superfluous parameter from CServer::NewClientNoAuthCallback
The `Reset` parameter was only ever set to true, at the only call site.
2018-05-09 23:50:25 +02:00
def 3f7b18322c Set up DB by default 2018-04-24 23:07:51 +02:00
heinrich5991 f8277267a0 Remove mem_alloc and mem_free, use standard C functions instead
Replace `mem_free` by `free`, and `mem_alloc` by `malloc` or `calloc`
(the latter one being used to allocate a zeroed array of elements,
sometimes, this makes a call to `mem_zero` superfluous).

This results in having to remove `mem_stats` which previously recorded
the number of allocations and their size that the Teeworlds code did
directly.

Remove OOM handling in `src/game/client/components/binds.cpp`.

Remove needless copying in the CSV code in
`src/game/client/components/statboard.cpp`.
2018-04-09 11:56:39 +02:00
Dennis Felsing 5a53e4c54d Fix compilation 2018-04-03 10:27:19 +02:00
heinrich5991 11304661db Put name ban stuff into a separate file
Fix a bug when overlong names could be used to circumvent name bans. Add
tests for name bans.
2018-03-14 02:35:31 +01:00
heinrich5991 d7f6cf2892 Fix some system.c insanity
`str_utf8_isspace` now returns true if the passed code point renders as
a space, instead of when not.

Add `str_utf8_trim_right`, use this function and
`str_utf8_skip_whitespaces` in the server.

Add tests for the three functions
2018-03-14 02:27:15 +01:00
Learath 729a42adec More style 2018-03-13 00:13:50 +01:00
Learath b7610901e3 Handle empty reason. Fix formatting 2018-03-12 23:29:46 +01:00
Learath 22c21f73ae Actually display the reason 2018-03-12 19:09:53 +01:00
Learath c1a7c30f0f Add reason to name bans 2018-03-12 19:05:49 +01:00
heinrich5991 31a3e8d4c0 Add possibility to ban players by name
This uses the Unicode confusable data together with judging how close
two strings are by using the Levenshtein distance.

Adds the commands `name_ban`, `name_unban` and `name_bans`. Kicks
players who join using a banned name and doesn't allow ingame players to
change their names to the banned ones.
2018-03-09 20:30:27 +01:00
heinrich5991 61c7e9307d Don't log out on sv_rcon{,_mod,_helper}_password if not changed 2018-02-26 18:01:02 +01:00
heinrich5991 1c3dc8c316 Record rcon authentication stuff into teehistorian
This allows to check moderator actions after-the-fact.
2018-01-28 03:13:05 +01:00
heinrich5991 eb31a52b83 Add very basic test for Unix sockets 2017-12-20 16:56:44 +01:00
heinrich5991 1a236dbefc Send connection information to external server 2017-12-20 16:56:34 +01:00
heinrich5991 94acac91a0 Overhauled job system
The engine now takes `std::shared_ptr<IJob>`, this will ensure the
appropriate lifetime of the given parameters, it also allows for proper
destruction. Remove the now obsolete `IFetcher` interface and `CFetcher`
class.

Also adds some locks to `CUpdater`, previously it didn't have any locks
at all.
2017-11-23 15:47:38 +01:00
heinrich5991 8e778cd9ab Address pull request comments 2017-10-13 02:29:18 +02:00
heinrich5991 2fc018aac3 Add asynchronous file output, port dbg_msg()s to that system
Also add tests.
2017-10-10 04:11:14 +02:00
Learath2 d15dcd3c58 Merge pull request #871 from heinrich5991/ddnet_teehistorian
Teehistorian
2017-10-09 18:42:27 +02:00
Dennis Felsing 4fe6dc51f7 Fix non-random announcements (thanks noby) 2017-09-26 14:20:37 +02:00
heinrich5991 9761e9606a Make most user input teehistoric
Exclude private stuff like chat messages and votes.
2017-09-20 02:23:28 +02:00
heinrich5991 6ef9c8dbcd First working version of teehistorian
teehistorian records all inputs from the players as well as the player
positions in each tick. It stores this info in a highly compressible
output format (I've achived 5x compression using xz or bz2).
2017-09-20 02:16:11 +02:00
Redix 43f246f174 Made int packing functions safe 2017-09-17 02:36:50 +02:00
def 89ed22e8d8 Introduce ddnet-info.json
- Single json file containing all information for the client
- Fetched from https://info.ddnet.tw/info?name=deen
- Replaces versionsrv, news, ddnet-maps.json and ddnet-ranks.json
- Servers are sorted by most popular ones for respective player
- Always stays < 100 ms response time, compared to occasional 50 s for
  old ddnet-ranks.json
2017-09-03 17:42:04 +02:00
def 27b7549bba Make --silent stop stdout logging 2017-09-03 10:37:24 +02:00
heinrich5991 33315452c3 Merge branch 'master' into leak_fix 2017-07-31 20:42:32 +02:00
heinrich5991 1ebb4f89a6 Reopen: Add a flag for rcon login via username (#800)
This uses an extended protocol message to signal that rcon
authentication might require a username, allowing the client to enable
the username prompt.

Add a forgotten logout on key update
2017-07-24 21:43:55 +02:00
HMH bfc5700314 Yes the Kernel and Interfaces need to be deleted too... 2017-07-21 19:46:31 +02:00
def f3e3d57a90 Always close files, cleaner demo recording, fix some other stuff 2017-07-08 13:39:20 +02:00
eeeee 0497cdd49d stop casting auth state to bool 2017-06-08 13:03:44 -07:00
eeeee 9c5ade24da remove ConDnsblStatus copypasta 2017-06-07 11:04:04 +02:00
eeeee 2797227063 also remove references to CGameContext from CServer 2017-06-05 22:31:56 -07:00
eeeee 9b6699d3b8 remove casts to CServer
improving encapsulation by going through the interface instead of including engine/server/server.h
2017-06-05 20:51:12 -07:00
heinrich5991 5ae37e6c72 Add protocol extension with UUIDs
This system can easily be extended by independent authors without
collisions, something the old system with plain increasing integers did
not allow.

Do this by utilizing the previously unused message code `NETMSG_NULL`
which has a value of 0.

This works for engine and game messages, snapshot items and events.
2017-05-25 00:52:43 +02:00
def f4112e3bcb Revert "Tees must be teamed up before loading"
This reverts commit d29f2306ef.
2017-05-14 22:36:44 +02:00
Dennis Felsing 58207926ac Merge pull request #726 from Learath2/dd_pr_load
Tees must be teamed up before loading
2017-05-14 11:54:39 +02:00
Ryozuki 3a4738560b Don't show ips to non-administrators, Fixes #694 (#739)
People with non-administrator rights won't be able to see ips (mod, helper).
2017-04-17 12:13:58 +02:00
Learath d29f2306ef Tees must be teamed up before loading 2017-04-11 21:18:26 +02:00
heinrich5991 1d81d56850 Introduce new, vanilla-compatible server info protocol
This means that we have a reliable and fast way to query for extended info,
while also not wasting network bandwidth.

The protocol is designed to be extensible, there's four bytes space for
encoding more request types (currently zeroed), and there's one string in each
response packet and one string for each player available (currently the empty
string).

The protocol itself has no problems with more than 64 players, although the
current client implementation will drop the player info after the 64th player,
because it uses a static array for storage.

Also fixes #130, the player list is just sorted each time new player info
arrives.
2017-03-29 12:56:13 +02:00
necropotame b8e4e5beea Fix style in several places 2017-03-22 19:45:14 +01:00