diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/clientpackethandler.cpp | 6 | ||||
-rw-r--r-- | src/network/serverpackethandler.cpp | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 6683af471..3ff23453d 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -86,7 +86,8 @@ void Client::handleCommand_Hello(NetworkPacket* pkt) // we recieved a TOCLIENT_HELLO while auth was already going on errorstream << "Client: TOCLIENT_HELLO while auth was already going on" << "(chosen_mech=" << m_chosen_auth_mech << ")." << std::endl; - if (m_chosen_auth_mech == AUTH_MECHANISM_SRP) { + if (m_chosen_auth_mech == AUTH_MECHANISM_SRP || + m_chosen_auth_mech == AUTH_MECHANISM_LEGACY_PASSWORD) { srp_user_delete((SRPUser *) m_auth_data); m_auth_data = 0; } @@ -1294,7 +1295,8 @@ void Client::handleCommand_UpdatePlayerList(NetworkPacket* pkt) void Client::handleCommand_SrpBytesSandB(NetworkPacket* pkt) { - if (m_chosen_auth_mech != AUTH_MECHANISM_SRP) { + if (m_chosen_auth_mech != AUTH_MECHANISM_SRP && + m_chosen_auth_mech != AUTH_MECHANISM_LEGACY_PASSWORD) { errorstream << "Client: Received SRP S_B login message," << " but wasn't supposed to (chosen_mech=" << m_chosen_auth_mech << ")." << std::endl; diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 0fd31f35e..07de20d60 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -232,6 +232,9 @@ void Server::handleCommand_Init(NetworkPacket* pkt) DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_SERVER_FAIL); return; } + } else if (base64_is_valid(encpwd)) { + auth_mechs |= AUTH_MECHANISM_LEGACY_PASSWORD; + client->enc_pwd = encpwd; } else { actionstream << "User " << playername << " tried to log in, but password field" @@ -1578,7 +1581,8 @@ void Server::handleCommand_SrpBytesA(NetworkPacket* pkt) << "based_on=" << int(based_on) << " and len_A=" << bytes_A.length() << "." << std::endl; - AuthMechanism chosen = AUTH_MECHANISM_SRP; + AuthMechanism chosen = (based_on == 0) ? + AUTH_MECHANISM_LEGACY_PASSWORD : AUTH_MECHANISM_SRP; if (wantSudo) { if (!client->isSudoMechAllowed(chosen)) { @@ -1663,7 +1667,8 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt) return; } - if (client->chosen_mech != AUTH_MECHANISM_SRP) { + if (client->chosen_mech != AUTH_MECHANISM_SRP && + client->chosen_mech != AUTH_MECHANISM_LEGACY_PASSWORD) { actionstream << "Server: got SRP _M packet, while auth" << "is going on with mech " << client->chosen_mech << " from " << getPeerAddress(pkt->getPeerId()).serializeString() |