Skip to content

Commit

Permalink
Auth: Simplify 1.12 ToTP support
Browse files Browse the repository at this point in the history
And to give OG shoutout to who reversed this long ago:

Co-authored-by: Chaosvex <[email protected]>
  • Loading branch information
2 people authored and killerwife committed Nov 13, 2024
1 parent 4db0594 commit a62b885
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 a62b885

Please sign in to comment.