Skip to content

Commit

Permalink
Auth: Simplify 1.12 ToTP support
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa committed Oct 21, 2024
1 parent 8219b20 commit 22f0bc8
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions src/realmd/AuthSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,26 +626,18 @@ bool AuthSocket::_HandleLogonProof()
});
return;
}
bool pinResult = true;

if (self->m_promptPin && (lp->securityFlags & SECURITY_FLAG_PIN))
pinResult = false;

if (self->m_promptPin && (lp->securityFlags & SECURITY_FLAG_PIN) && !self->_token.empty())
if ((lp->securityFlags & SECURITY_FLAG_PIN) && !self->_token.empty())
{
auto pin = self->generateToken(self->_token.c_str());

if (pin != uint32(-1))
pinResult = self->VerifyPinData(pin, lp->pinData);

int32 serverToken = self->generateToken(self->_token.c_str());
if (!self->VerifyPinData(serverToken, lp->pinData))
{
BASIC_LOG("[AuthChallenge] Account %s tried to login with wrong pincode!", self->_login.c_str());
self->Write(logonProofUnknownAccount, sizeof(logonProofUnknownAccount), [self](const boost::system::error_code& error, std::size_t read) {});
return;
}
}

if (!pinResult)
{
BASIC_LOG("[AuthChallenge] Account %s tried to login with wrong pincode!", self->_login.c_str());
self->Write(logonProofUnknownAccount, sizeof(logonProofUnknownAccount), [self](const boost::system::error_code& error, std::size_t read) {});
return;
}
self->verifyVersionAndFinalizeAuthentication(lp);
}
else
Expand Down

0 comments on commit 22f0bc8

Please sign in to comment.