aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-04-27 19:32:51 +0200
committersfan5 <sfan5@live.de>2022-04-28 19:55:36 +0200
commit00f71c3b9d35e1cdd5aa62491a46068358aa8b2a (patch)
tree199e4113740b9c6b0bb5829d72bf30d7fa5f8997
parent3d2bf8fb021ea839944830e212789532ba3f0370 (diff)
downloadhax-minetest-server-00f71c3b9d35e1cdd5aa62491a46068358aa8b2a.tar.gz
hax-minetest-server-00f71c3b9d35e1cdd5aa62491a46068358aa8b2a.zip
Fix password changing getting stuck if wrong password is entered once
-rw-r--r--src/clientiface.cpp9
-rw-r--r--src/clientiface.h2
-rw-r--r--src/network/serverpackethandler.cpp2
3 files changed, 13 insertions, 0 deletions
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index a1c3e1187..a4bfb8242 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -596,6 +596,15 @@ void RemoteClient::notifyEvent(ClientStateEvent event)
}
}
+void RemoteClient::resetChosenMech()
+{
+ if (chosen_mech == AUTH_MECHANISM_SRP) {
+ srp_verifier_delete((SRPVerifier *) auth_data);
+ auth_data = nullptr;
+ }
+ chosen_mech = AUTH_MECHANISM_NONE;
+}
+
u64 RemoteClient::uptime() const
{
return porting::getTimeS() - m_connection_time;
diff --git a/src/clientiface.h b/src/clientiface.h
index 947952e82..3e7ba4793 100644
--- a/src/clientiface.h
+++ b/src/clientiface.h
@@ -243,6 +243,8 @@ public:
u32 allowed_auth_mechs = 0;
u32 allowed_sudo_mechs = 0;
+ void resetChosenMech();
+
bool isSudoMechAllowed(AuthMechanism mech)
{ return allowed_sudo_mechs & mech; }
bool isMechAllowed(AuthMechanism mech)
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 51061f57b..125e85cab 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -1639,6 +1639,7 @@ void Server::handleCommand_SrpBytesA(NetworkPacket* pkt)
<< std::endl;
if (wantSudo) {
DenySudoAccess(peer_id);
+ client->resetChosenMech();
return;
}
@@ -1705,6 +1706,7 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt)
<< " tried to change their password, but supplied wrong"
<< " (SRP) password for authentication." << std::endl;
DenySudoAccess(peer_id);
+ client->resetChosenMech();
return;
}