Fix password changing getting stuck if wrong password is entered once
This commit is contained in:
parent
686a119e0f
commit
33e2be6bd2
@ -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
|
u64 RemoteClient::uptime() const
|
||||||
{
|
{
|
||||||
return porting::getTimeS() - m_connection_time;
|
return porting::getTimeS() - m_connection_time;
|
||||||
|
@ -242,6 +242,8 @@ public:
|
|||||||
u32 allowed_auth_mechs = 0;
|
u32 allowed_auth_mechs = 0;
|
||||||
u32 allowed_sudo_mechs = 0;
|
u32 allowed_sudo_mechs = 0;
|
||||||
|
|
||||||
|
void resetChosenMech();
|
||||||
|
|
||||||
bool isSudoMechAllowed(AuthMechanism mech)
|
bool isSudoMechAllowed(AuthMechanism mech)
|
||||||
{ return allowed_sudo_mechs & mech; }
|
{ return allowed_sudo_mechs & mech; }
|
||||||
bool isMechAllowed(AuthMechanism mech)
|
bool isMechAllowed(AuthMechanism mech)
|
||||||
|
@ -1655,6 +1655,7 @@ void Server::handleCommand_SrpBytesA(NetworkPacket* pkt)
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
if (wantSudo) {
|
if (wantSudo) {
|
||||||
DenySudoAccess(peer_id);
|
DenySudoAccess(peer_id);
|
||||||
|
client->resetChosenMech();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1721,6 +1722,7 @@ void Server::handleCommand_SrpBytesM(NetworkPacket* pkt)
|
|||||||
<< " tried to change their password, but supplied wrong"
|
<< " tried to change their password, but supplied wrong"
|
||||||
<< " (SRP) password for authentication." << std::endl;
|
<< " (SRP) password for authentication." << std::endl;
|
||||||
DenySudoAccess(peer_id);
|
DenySudoAccess(peer_id);
|
||||||
|
client->resetChosenMech();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user