summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2010-04-11 17:23:11 +0000
committersmatz <smatz@openttd.org>2010-04-11 17:23:11 +0000
commit13e5058efe0d2712b997f810949d6e2a51adfbdd (patch)
treef0af745547ea03c1c01a435f3789932cb5cd98d1 /src
parent11d6e21c3ac658b065b64c5c9d0f43c45d7966db (diff)
downloadopenttd-13e5058efe0d2712b997f810949d6e2a51adfbdd.tar.xz
(svn r19608) -Fix: do not kick client if he entered password and the password was cleared meanwhile
Diffstat (limited to 'src')
-rw-r--r--src/network/network_server.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 8fc37bb1b..4b664791f 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -754,8 +754,9 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_GAME_PASSWORD)
char password[NETWORK_PASSWORD_LENGTH];
p->Recv_string(password, sizeof(password));
- /* Check game password */
- if (strcmp(password, _settings_client.network.server_password) != 0) {
+ /* Check game password. Allow joining if we cleared the password meanwhile */
+ if (!StrEmpty(_settings_client.network.server_password) &&
+ strcmp(password, _settings_client.network.server_password) != 0) {
/* Password is invalid */
return SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_WRONG_PASSWORD);
}
@@ -778,9 +779,10 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMPANY_PASSWORD)
char password[NETWORK_PASSWORD_LENGTH];
p->Recv_string(password, sizeof(password));
- /* Check company password */
+ /* Check company password. Allow joining if we cleared the password meanwhile */
const NetworkClientInfo *ci = cs->GetInfo();
- if (strcmp(password, _network_company_states[ci->client_playas].password) != 0) {
+ if (!StrEmpty(_network_company_states[ci->client_playas].password) &&
+ strcmp(password, _network_company_states[ci->client_playas].password) != 0) {
/* Password is invalid */
return SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_WRONG_PASSWORD);
}