1500 Commits

Author SHA1 Message Date
gfgtdf
8f4c8540c3 improve wesnoth version warning 3
suggested by soliton

(cherry-picked from commit bd16aeec02ceeeca42b281cfe2bf46a5f3791bca)
2018-10-07 03:24:11 +00:00
gfgtdf
f517f3af74 fix missing map previews in the lobby
regression from 'fix require_scenario & require_era'

(cherry-picked from commit 9a3917dc3518455b0b8fa03f95ea71217a23550c)
2018-10-07 03:24:11 +00:00
gfgtdf
932edd30c5 fix segfault in wesnothd
broken in commit 'preserve traslatable strings in simple_wml.'

(cherry-picked from commit 7e0d63d7c32b4c280baa63cb60dc32c565ea0eae)
2018-10-07 03:24:11 +00:00
gfgtdf
96eb02aecc fix oos when undoing after ally chat
previously the server would send [speak] commands that had no undo=no attributes so that the game would remove the speak command from the replay instead of the actual undoable action when undoing an action.

(cherry-picked from commit 02bed5c0335893542f5f3732ea013ab1ca705c55)
2018-10-07 03:24:10 +00:00
gfgtdf
d3d7e8f297 improve wesnoth version warning further
(cherry-picked from commit 90fb50d70fc1a4847ea0098cb356798935b6bda8)
2018-10-07 03:23:56 +00:00
gfgtdf
4d736064e9 improve wesnoth version warning.
(cherry-picked from commit ba18e17e433bec13db77b82a5fdeaeaffa765fe4)
2018-10-07 03:23:56 +00:00
gfgtdf
cb6b7b4318 add server notifications about outdated wesnoth versions.
(cherry-picked from commit 610e4f2969cc8f0b87a537a09138d64efbbf3a2b)
2018-10-07 03:23:55 +00:00
gfgtdf
b5b1065113 fix require_scenario & require_era
previously both were broken:
1) 'require_scenario' was only checked if the scenario was installed
which obviously doesn't make any sense at all.
2) 'require_scenario' was read from the local scenario data instead from
the remote scenario.
3) 'require_era' was only checked when the scenario was not installed,
so people who do have an outated version of the era installed could not
join bacause it assumed require_era=yes in that case.
4) the server tried to read 'require_scenario' from the wrong wml node,
'require_scenario' is an attribute of [scenario] and not of savefile
toplevel.

(cherry-picked from commit eec8b674de6d04f13f5b875c1b1e6b953e45ef9e)
2018-10-07 03:23:55 +00:00
gfgtdf
59a79348a6 preserve traslatable strings in simple_wml.
previously it would happen that for example an attribute like
`side_name=_"female^Footpads"` in side would get its translatable mark (_)
removed after the game has started. This meant that observers that enterd
the game after it started would see the literal string "female^Footpads"
in the status side overview window.

The new code marks all translatable simple_wml attributes to make sure their
translatable mark is preserved along with their textdomain. It can still
happen though that attributes will appear in the the wrong textdomain area
after simple_wml processing though because in some cases note::output
might skip over textdomain markers. It is still not as bad as string like
"female^Footpads" appearing in the ui though.

An alterntive appraoch to fix this issue would be to carefully make sure
not to change any atributes of wml tags that can also contain translatable
attributes, which would probably imply not editing the wml objects received
by the client at all and instead storing the new information (in particular
side information like is_local=yes/no) in a seperate wml object. (that would
then be sended to the clients along with the original scenario wml objects.)

fixes #1420

(cherry-picked from commit eb23ac56461c8d57dc5d1aee018832c2dc7dcf36)
2018-10-07 03:23:54 +00:00
gfgtdf
fabdf38a9e don't use std::pair
instead we use a custom struct. std::pair is bad becasue you never know
what "first" or "second" mean.

(cherry-picked from commit c4aacbe31f31799861e03f4b7f7b241bee64aa65)
2018-10-07 03:23:54 +00:00
ProditorMagnus
b1c5004465 Make /q sl and status case insensitive
(cherry-picked from commit 625f18ab2e5d98765fd2b669da9f9697d331ab5d)
2018-10-07 03:23:43 +00:00
Martin Hrubý (hrubymar10)
674fda85b7 Migrate links to https if available - Fwd c18537edc0678f40a209797d72dfaba3e5e88545
(cherry-picked from commit bc4d22dc72e79c3d6a3364ac896e473afd298246)
2018-10-07 03:23:36 +00:00
Jyrki Vesterinen
9ebdebc034 Fix #2813: wrong chat color after a side is unassigned from a player
Regression from commit 36e9290.

As @gfgtdf pointed out in the bug report, because old_player was a
reference to the shared_ptr, resetting the shared_ptr in sides_ also
changed old_player, and thus 'the player lost his last side' check never
passed.

Thanks to @gfgtdf for figuring out the cause.

(cherry-picked from commit 95f19745ca87a5e7e3beecf69cbc84b1840ed076)
2018-10-07 03:23:24 +00:00
Iris Morelle
7e51f119de wesnothd: Fix lobby messages and whispers not being truncated as they should
For lobby messages, there was a length cap in place already, but the
truncated message was lost in processing because it ended up in a WML
document that isn't the one relayed to listening clients.

On the other hand, whisper messages were missing the truncate logic
entirely. Oops.

(The logic for in-game messages does truncate messages correctly as far
as I can tell, and additionally the client UI doesn't allow overlong
messages.)

Thanks to Soliton for pointing me towards the faulty code.

(cherry-picked from commit cdc8da25aea2cbc055dc12879d2c4333fecfc3e1)
2018-10-07 03:22:47 +00:00
Iris Morelle
b14b1e9509 wesnothd: Only disclose the number of online admins to admins using adminmsg
(cherry-picked from commit be41a692fb44cba62b720a462f5bebe7efec303c)
2018-10-07 03:22:46 +00:00
loonycyborg
231bb484e7 wesnothd: fix prematurely adding new players to games_and_users_list_
If dc happens during asio read that would call server::add_player
then a "ghost" player will appear in games_and_users_list_. Fix works by
moving the list update into the handler, it will be called only if read is
successful.

This should prevent issue #2989 unless it has some other mechanism

(cherry-picked from commit 787a1a0dae41e68d237cacd9ceca381d6dad76df)
2018-10-07 03:22:19 +00:00
loonycyborg
f8361aa7d1 wesnothd: fix server terminating in response to unregistered login
if unregistered logins are allowed

(cherry-picked from commit 0c0bf7f91d7654a7ac83861236b5e0589e1bbcaf)
2018-10-07 03:22:18 +00:00
loonycyborg
e1a7e08a92 wesnothd: avoid needlessly casting pointer to long int
(cherry-picked from commit a25180893344c6a99013e6b94eb3cb7110b1d987)
2018-10-07 03:22:17 +00:00
loonycyborg
77376ff378 wesnothd: restore lan server auto-shutdown functionality
(cherry-picked from commit 4eea1b5f0d4a0de9155c23be8a5abe097cf23f09)
2018-10-07 03:22:15 +00:00
loonycyborg
d3a6580908 wesnothd: restore functionality to log stats every 5 minutes
(cherry-picked from commit 0714d488bcd1eadd37c7785a1066925d5fa1b0d8)
2018-10-07 03:22:14 +00:00
loonycyborg
361c98c91c Update server to use new way of getting wesnoth version
(cherry-picked from commit 57da02a9196f6b616ade01cda3de08f2d40ba554)
2018-10-07 03:22:14 +00:00
loonycyborg
3ef2eb1ae5 server: remember client's ip in player_connections_ and use it in remove_player()
this is needed so ip is properly logged even if socket is closed or invalid

(cherry-picked from commit aaabbf2687ea0bc25dc3a9f8705fe0b6f29c1af2)
2018-10-07 03:22:14 +00:00
Gunter Labes
e4100fc3bd check for empty parameters before looping over all players
(cherry-picked from commit 0362e36305eda584d16fb89de40f9314278316e0)
2018-10-07 03:22:13 +00:00
gfgtdf
1a72f04d4a rename mp command player_version to version
(cherry-picked from commit 0853b2718d1344449a23ae68252330d457f29f3a)
2018-10-07 03:22:13 +00:00
gfgtdf
454c44f8bb add player_version mp command
to tell you what wesnoth version another player is using.

(cherry-picked from commit ba6afa4d1706a30c067a15ab26c1ab3b9ef5b87b)
2018-10-07 03:22:12 +00:00
Charles Dang
15206762cc Deployed std::make_unique and std::make_shared in more places
(cherry-picked from commit cc2cc29376fa19aa21b705a9754496d7f6d30162)
2018-10-07 03:22:02 +00:00
Charles Dang
86f6debd57 Convert a few remaining cases of boost::uint32_t to uint32_t
(cherry-picked from commit ba6fa1e46bb33b69c76d223898e4d448df74087d)
2018-10-07 03:21:15 +00:00
Charles Dang
f89596344a Wesnothd: minor code cleanup
(cherry-picked from commit 2d600d10dcca7eebe83f35623b0014d574f225b9)
2018-10-07 03:21:14 +00:00
Charles Dang
fc9e086b0f Wesnothd: formatting cleanup
(cherry-picked from commit 9a2d09f97ef62dd732aecc8887b488020dce58f4)
2018-10-07 03:21:13 +00:00
Charles Dang
5d18e8274b Wesnothd: dropped a giant block of commented-out code
This is a relic from the old pro-Boost ASIO implementation.

(cherry-picked from commit b623e7a647d7c88f4113b8bddcd6867ea7eb67e0)
2018-10-07 03:21:13 +00:00
Charles Dang
19e3afb463 Convert C-style casts to static_cast
(cherry-picked from commit 0dc5656c328cdd02eebb4dbd10dbab3eb4553b57)
2018-10-07 03:21:02 +00:00
Charles Dang
64d176530f Use std::tm instead of plain C tm
(cherry-picked from commit 36e83e646c01906bf1b2ae4694f840f25ee7f349)
2018-10-07 03:21:01 +00:00
Charles Dang
16fdbc417a Use std::localtime() instead of plain C localtime()
(cherry-picked from commit 00bea6494ff7ac84f569bc568267fd630aded83e)
2018-10-07 03:21:01 +00:00
Charles Dang
399b589e60 Use std::time() instead of plain C time()
(cherry-picked from commit d26824901de8c76a32742ebf1d1c3331fe082a60)
2018-10-07 03:21:01 +00:00
Charles Dang
21580d3ef1 Use std::time_t instead of plain C time_t
(cherry-picked from commit ccbb736a180d37f2640cd56331b91f855c728464)
2018-10-07 03:21:00 +00:00
Iris Morelle
f7a1408f22 wesnothd: Fix typo introduced recently causing build errors
Fixes commit 2bf4d68c87b69256266b7745a9e3453693794e35.

(cherry-picked from commit c8c3625e3a86b61b592f19bf80d2410d46e8187c)
2018-10-07 03:20:58 +00:00
Charles Dang
d9fb6c0bf5 Catch all exceptions (where possible) as const references
A few catch blocks modify something in their exceptions, so those are kept non-const.

(cherry-picked from commit 2bf4d68c87b69256266b7745a9e3453693794e35)
2018-10-07 03:20:58 +00:00
Iris Morelle
135fc575bc fuh: Add NOTE on the status of glob bans
[ci skip]

(cherry-picked from commit c0f160b35150d1893b77da43de3279dfe54fc10c)
2018-10-07 03:20:30 +00:00
Iris Morelle
61af81c914 wesnothd/fuh: Check IP address bans before everything else
There isn't much point in doing more expensive ban look ups first.

(Also, yes, I am aware that as it is there's still two SELECT queries
that could be coalesced into a single one -- namely, the ones for the
user_email and user_id columns.)

(cherry-picked from commit d48c84236c17adca9421fe15d0d0666f1c2b96cb)
2018-10-07 03:20:29 +00:00
Iris Morelle
3dc31e66f5 wesnothd: Report different user_handler ban types
This enables reporting back to the client the specific type of ban that
affects the account. This information is already normally provided by
phpBB when trying to view a page while banned, so we are not leaking any
new information here.

There isn't an API to retrieve the (user-visible) ban reason from the
ban list yet. It's probably not worth worrying about it since affected
users can see it when navigating to forums.wesnoth.org anyway.

(cherry-picked from commit 749e684f03982fe268ab15074f28d701d0e55f18)
2018-10-07 03:20:29 +00:00
Iris Morelle
aa8c1793d9 wesnothd: Initial support for checking forum bans during login
This adds a user_is_banned() method to the user_handler classes that
returns whether a given username (and optionally IP address) is banned
by the user_handler platform. Obviously right now this is only intended
to work with forum_user_handler and phpBB.

Forum bans are checked against entries in the banlist table using
username (actually user id), IP address, and email address where
applicable. A user matching a ban on any of those three items will not
be permitted into the server *unless* they have the moderator flag set.
It might be worth making an exception for board founders as well,
although that is probably orthogonal to this patchset.

Right now there are a few missing items:

 * The server sends clients an error that allows them to try again with
   a different username/password combination immediately. Nothing stops
   them from causing noise in the server logs this way, so we probably
   need to ensure this counts as an authentication failure for the
   purpose of temporarily and automatically banning the IP address.

 * The user handler doesn't allow retrieving details about the ban, so
   all that the main server code can do is report back to the client as
   their nickname being banned, when this is not necessarily the case
   (email or IP address bans). I need to figure out a better API for
   retrieving this info.

 * Likewise, the server does not log the specifics about the matched ban
   yet unless the mp_user_handler log domain is set to the info log
   level.

 * There's no i18n support on the client side for the error message sent
   by the server -- which is going to change anyway.

 * Testing this patch uncovered an issue with the MP client not
   displaying messages sent during the login sequence, including the mod
   authentication notice.

(cherry-picked from commit f2c06f0a4e0d82a8e2a78d4ad25c91c09a6c2b63)
2018-10-07 03:20:29 +00:00
loonycyborg
0b9a41cf1c wesnothd: add a check to prevent crash from accessing game owner not in player_connections_
(cherry-picked from commit 10ee2b2d29add3f45bcd06def0f41913dda47cfe)
2018-10-07 03:20:23 +00:00
loonycyborg
6bb4d43c37 wesnothd: process wml commands one at a time in handle_read_from_player
as is done in rest of wesnothd. This also fixes crash from self-kick
due to it trying to continue processing looking for further tags
after /query kick kicked the user in quesion.

(cherry-picked from commit 6a310f0c79d002cbe53d9ee4f12b95a3b31c721b)
2018-10-07 03:20:19 +00:00
loonycyborg
2a7aa40403 wesnothd: fix game host kick command kicking host itself instead of intended target
(cherry-picked from commit 40ae6c535615598d047d6682a81f0f8654b77b88)
2018-10-07 03:20:17 +00:00
loonycyborg
e53876067d wesnothd: fix crash from using reference to deleted object
(cherry-picked from commit b0cbe3adf75a366c6887c6318d40cb55bf02fceb)
2018-10-07 03:20:15 +00:00
loonycyborg
1767f81576 wesnothd: Fix remaining incorrect uses of simple_wml::get_attr instead of get_attr_dup
(cherry-picked from commit 688ae150ccb221a5d8d2e93421c8b165ec86a247)
2018-10-07 03:20:11 +00:00
Charles Dang
e2a6454100 Made use of config_attribute_value::to_time_t
(cherry-picked from commit 6dfb87103c629cd91d57fc87934a3fb2d1177834)
2018-10-07 03:19:55 +00:00
loonycyborg
61b25644b3 wesnothd: refuse to send whispers from observers to players in same game
wesnothd <= 1.12 did this too, this restores old behavior

(cherry-picked from commit 10122057e6886b2c52066783fa9b5edc60196c09)
2018-10-07 03:19:40 +00:00
loonycyborg
90ff4efd3c wesnothd: always wait for next login attempt after login fail
(cherry-picked from commit 99372123da53990466b4a52bb1f206f2a1a73c75)
2018-10-07 03:19:36 +00:00
Charles Dang
e17bfe395f Wesnothd/Player: removed unused selective_ping member
(cherry-picked from commit dab8498f97b0903f9ebb85ab5b1fc14bc09b5d97)
2018-10-07 03:19:33 +00:00