(svn r19608) -Fix: do not kick client if he entered password and the password was cleared meanwhile

This commit is contained in:
smatz 2010-04-11 17:23:11 +00:00
parent 11d6e21c3a
commit 13e5058efe

View File

@ -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);
}