Skip to content

Commit 55591da

Browse files
insunaakillerwife
authored andcommitted
Auth: Simplify 1.12 ToTP support
1 parent 1c3fc4e commit 55591da

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/realmd/AuthSocket.cpp

+8-16
Original file line numberDiff line numberDiff line change
@@ -626,26 +626,18 @@ bool AuthSocket::_HandleLogonProof()
626626
});
627627
return;
628628
}
629-
bool pinResult = true;
630629

631-
if (self->m_promptPin && (lp->securityFlags & SECURITY_FLAG_PIN))
632-
pinResult = false;
633-
634-
if (self->m_promptPin && (lp->securityFlags & SECURITY_FLAG_PIN) && !self->_token.empty())
630+
if ((lp->securityFlags & SECURITY_FLAG_PIN) && !self->_token.empty())
635631
{
636-
auto pin = self->generateToken(self->_token.c_str());
637-
638-
if (pin != uint32(-1))
639-
pinResult = self->VerifyPinData(pin, lp->pinData);
640-
632+
int32 serverToken = self->generateToken(self->_token.c_str());
633+
if (!self->VerifyPinData(serverToken, lp->pinData))
634+
{
635+
BASIC_LOG("[AuthChallenge] Account %s tried to login with wrong pincode!", self->_login.c_str());
636+
self->Write(logonProofUnknownAccount, sizeof(logonProofUnknownAccount), [self](const boost::system::error_code& error, std::size_t read) {});
637+
return;
638+
}
641639
}
642640

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

0 commit comments

Comments
 (0)