AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "AuthSession.h"
Public Member Functions | |
AuthSession (tcp::socket &&socket) | |
void | Start () override |
bool | Update () override |
void | SendPacket (ByteBuffer &packet) |
Public Member Functions inherited from Socket< AuthSession > | |
Socket (tcp::socket &&socket) | |
virtual | ~Socket () |
virtual void | Start ()=0 |
virtual bool | Update () |
boost::asio::ip::address | GetRemoteIpAddress () const |
uint16 | GetRemotePort () const |
void | AsyncRead () |
void | AsyncReadProxyHeader () |
void | AsyncReadWithCallback (void(T::*callback)(boost::system::error_code, std::size_t)) |
void | QueuePacket (MessageBuffer &&buffer) |
ProxyHeaderReadingState | GetProxyHeaderReadingState () const |
bool | IsOpen () const |
void | CloseSocket () |
void | DelayedCloseSocket () |
Marks the socket for closing after write buffer becomes empty. More... | |
MessageBuffer & | GetReadBuffer () |
Static Public Member Functions | |
static std::unordered_map< uint8, AuthHandler > | InitHandlers () |
Public Attributes | |
uint32 | BattlegroupID = 0 |
uint32 | LoginServerType = 0 |
uint32 | RealmID = 0 |
uint32 | Build = 0 |
std::array< uint8, 4 > | LocalChallenge = {} |
uint32 | LoginServerID = 0 |
uint32 | RegionID = 0 |
uint64 | DosResponse = 0 |
Acore::Crypto::SHA1::Digest | Digest = {} |
std::string | Account |
ByteBuffer | AddonInfo |
Protected Member Functions | |
void | ReadHandler () override |
Protected Member Functions inherited from Socket< AuthSession > | |
virtual void | OnClose () |
virtual void | ReadHandler ()=0 |
bool | AsyncProcessQueue () |
void | SetNoDelay (bool enable) |
Private Types | |
typedef Socket< AuthSession > | AuthSocket |
Private Member Functions | |
bool | HandleLogonChallenge () |
bool | HandleLogonProof () |
bool | HandleReconnectChallenge () |
bool | HandleReconnectProof () |
bool | HandleRealmList () |
void | CheckIpCallback (PreparedQueryResult result) |
void | LogonChallengeCallback (PreparedQueryResult result) |
void | ReconnectChallengeCallback (PreparedQueryResult result) |
void | RealmListCallback (PreparedQueryResult result) |
bool | VerifyVersion (uint8 const *a, int32 aLength, Acore::Crypto::SHA1::Digest const &versionProof, bool isReconnect) |
Private Attributes | |
Optional< Acore::Crypto::SRP6 > | _srp6 |
SessionKey | _sessionKey = {} |
std::array< uint8, 16 > | _reconnectProof = {} |
AuthStatus | _status |
AccountInfo | _accountInfo |
Optional< std::vector< uint8 > > | _totpSecret |
std::string | _localizationName |
std::string | _os |
std::string | _ipCountry |
uint16 | _build |
uint8 | _expversion |
QueryCallbackProcessor | _queryProcessor |
|
private |
AuthSession::AuthSession | ( | tcp::socket && | socket | ) |
|
private |
References Socket< AuthSession >::AsyncRead(), AUTH_LOGON_CHALLENGE, Socket< AuthSession >::GetRemoteIpAddress(), Socket< AuthSession >::GetRemotePort(), LOG_DEBUG, SendPacket(), and WOW_FAIL_BANNED.
Referenced by Start().
|
private |
References _build, _expversion, _localizationName, _os, _queryProcessor, _status, AsyncCallbackProcessor< T >::AddCallback(), AUTH_LOGON_CHALLENGE_INITIAL_SIZE, AUTH_LOGON_CHALLENGE_C::build, AUTH_LOGON_CHALLENGE_C::country, Socket< AuthSession >::GetReadBuffer(), MessageBuffer::GetReadPointer(), Socket< AuthSession >::GetRemoteIpAddress(), AUTH_LOGON_CHALLENGE_C::I, AUTH_LOGON_CHALLENGE_C::I_len, AuthHelper::IsPostBCAcceptedClientBuild(), AuthHelper::IsPreBCAcceptedClientBuild(), LOG_DEBUG, LOGIN_SEL_LOGONCHALLENGE, LoginDatabase, LogonChallengeCallback(), NO_VALID_EXP_FLAG, AUTH_LOGON_CHALLENGE_C::os, POST_BC_EXP_FLAG, PRE_BC_EXP_FLAG, AUTH_LOGON_CHALLENGE_C::size, and STATUS_CLOSED.
Referenced by InitHandlers().
|
private |
References _accountInfo, _expversion, _localizationName, _os, _sessionKey, _srp6, _status, _totpSecret, AUTH_LOGON_PROOF_C::A, AUTH_LOGON_PROOF_S::AccountFlags, AUTH_LOGON_PROOF, AUTH_LOGON_PROOF_C::clientM, AUTH_LOGON_PROOF_S::cmd, AUTH_LOGON_PROOF_S_OLD::cmd, ByteBuffer::contents(), AUTH_LOGON_PROOF_C::crc_hash, AUTH_LOGON_PROOF_S::error, AUTH_LOGON_PROOF_S_OLD::error, AccountInfo::FailedLogins, GetLocaleByName(), Socket< AuthSession >::GetReadBuffer(), MessageBuffer::GetReadPointer(), Socket< AuthSession >::GetRemoteIpAddress(), Socket< AuthSession >::GetRemotePort(), Acore::Crypto::SRP6::GetSessionVerifier(), AccountInfo::Id, LOG_DEBUG, LOG_INFO, AccountInfo::Login, LOGIN_INS_ACCOUNT_AUTO_BANNED, LOGIN_INS_FALP_IP_LOGGING, LOGIN_INS_IP_AUTO_BANNED, LOGIN_UPD_FAILEDLOGINS, LOGIN_UPD_LOGONPROOF, LoginDatabase, AUTH_LOGON_PROOF_S::LoginFlags, AUTH_LOGON_PROOF_S::M2, AUTH_LOGON_PROOF_S_OLD::M2, NO_VALID_EXP_FLAG, POST_BC_EXP_FLAG, MessageBuffer::ReadCompleted(), ByteBuffer::resize(), sConfigMgr, AUTH_LOGON_PROOF_C::securityFlags, SendPacket(), PreparedStatementBase::SetData(), STATUS_AUTHED, STATUS_CLOSED, AUTH_LOGON_PROOF_S::SurveyId, AUTH_LOGON_PROOF_S_OLD::unk2, Acore::Crypto::TOTP::ValidateToken(), VerifyVersion(), WOW_FAIL_UNKNOWN_ACCOUNT, and WOW_FAIL_VERSION_INVALID.
Referenced by InitHandlers().
|
private |
References _accountInfo, _queryProcessor, _status, AsyncCallbackProcessor< T >::AddCallback(), AccountInfo::Id, LOG_DEBUG, LOGIN_SEL_REALM_CHARACTER_COUNTS, LoginDatabase, RealmListCallback(), PreparedStatementBase::SetData(), and STATUS_WAITING_FOR_REALM_LIST.
Referenced by InitHandlers().
|
private |
References _build, _expversion, _localizationName, _os, _queryProcessor, _status, AsyncCallbackProcessor< T >::AddCallback(), AUTH_LOGON_CHALLENGE_INITIAL_SIZE, AUTH_LOGON_CHALLENGE_C::build, AUTH_LOGON_CHALLENGE_C::country, Socket< AuthSession >::GetReadBuffer(), MessageBuffer::GetReadPointer(), Socket< AuthSession >::GetRemoteIpAddress(), AUTH_LOGON_CHALLENGE_C::I, AUTH_LOGON_CHALLENGE_C::I_len, AuthHelper::IsPostBCAcceptedClientBuild(), AuthHelper::IsPreBCAcceptedClientBuild(), LOG_DEBUG, LOGIN_SEL_RECONNECTCHALLENGE, LoginDatabase, NO_VALID_EXP_FLAG, AUTH_LOGON_CHALLENGE_C::os, POST_BC_EXP_FLAG, PRE_BC_EXP_FLAG, ReconnectChallengeCallback(), AUTH_LOGON_CHALLENGE_C::size, and STATUS_CLOSED.
Referenced by InitHandlers().
|
private |
References _accountInfo, _reconnectProof, _sessionKey, _status, AUTH_RECONNECT_PROOF, Acore::Impl::GenericHash< HashCreator, DigestLength >::Finalize(), Acore::Impl::GenericHash< HashCreator, DigestLength >::GetDigest(), Socket< AuthSession >::GetReadBuffer(), MessageBuffer::GetReadPointer(), Socket< AuthSession >::GetRemoteIpAddress(), Socket< AuthSession >::GetRemotePort(), LOG_DEBUG, LOG_ERROR, AccountInfo::Login, AUTH_RECONNECT_PROOF_C::R1, AUTH_RECONNECT_PROOF_C::R2, AUTH_RECONNECT_PROOF_C::R3, SendPacket(), STATUS_AUTHED, STATUS_CLOSED, Acore::Impl::GenericHash< HashCreator, DigestLength >::UpdateData(), VerifyVersion(), WOW_FAIL_VERSION_INVALID, and WOW_SUCCESS.
Referenced by InitHandlers().
|
static |
References AUTH_LOGON_CHALLENGE, AUTH_LOGON_CHALLENGE_INITIAL_SIZE, AUTH_LOGON_PROOF, AUTH_RECONNECT_CHALLENGE, AUTH_RECONNECT_PROOF, HandleLogonChallenge(), HandleLogonProof(), HandleRealmList(), HandleReconnectChallenge(), HandleReconnectProof(), REALM_LIST, REALM_LIST_PACKET_SIZE, STATUS_AUTHED, STATUS_CHALLENGE, STATUS_LOGON_PROOF, and STATUS_RECONNECT_PROOF.
|
private |
References _accountInfo, _build, _ipCountry, _localizationName, _srp6, _status, _totpSecret, ByteBuffer::append(), AUTH_LOGON_CHALLENGE, Field::Get(), GetLocaleByName(), Socket< AuthSession >::GetRemoteIpAddress(), Socket< AuthSession >::GetRemotePort(), AuthHelper::IsAcceptedClientBuild(), AccountInfo::IsBanned, AccountInfo::IsLockedToIP, AccountInfo::IsPermanentlyBanned, AccountInfo::LastIP, AccountInfo::LoadResult(), AccountInfo::LockCountry, LOG_DEBUG, LOG_ERROR, LOG_INFO, AccountInfo::Login, Acore::Crypto::SRP6::SALT_LENGTH, SECRET_TOTP_MASTER_KEY, SendPacket(), sIPLocation, sSecretMgr, STATUS_LOGON_PROOF, Acore::Crypto::SRP6::VERIFIER_LENGTH, VersionChallenge, WOW_FAIL_BANNED, WOW_FAIL_DB_BUSY, WOW_FAIL_LOCKED_ENFORCED, WOW_FAIL_SUSPENDED, WOW_FAIL_UNKNOWN_ACCOUNT, WOW_FAIL_UNLOCKABLE_LOCK, WOW_FAIL_VERSION_INVALID, and WOW_SUCCESS.
Referenced by HandleLogonChallenge().
|
overrideprotectedvirtual |
Implements Socket< AuthSession >.
References _status, Socket< AuthSession >::AsyncRead(), AUTH_LOGON_CHALLENGE, AUTH_RECONNECT_CHALLENGE, Socket< AuthSession >::CloseSocket(), MessageBuffer::GetActiveSize(), Socket< AuthSession >::GetReadBuffer(), MessageBuffer::GetReadPointer(), Handlers, MAX_ACCEPTED_CHALLENGE_SIZE, MessageBuffer::ReadCompleted(), MessageBuffer::Reset(), and AUTH_LOGON_CHALLENGE_C::size.
|
private |
References _accountInfo, _build, _expversion, _status, Realm::AllowedSecurityLevel, ByteBuffer::append(), RealmBuildInfo::BugfixVersion, Realm::Build, RealmBuildInfo::Build, Realm::Flags, Field::Get(), Realm::GetAddressForClient(), Socket< AuthSession >::GetRemoteIpAddress(), Realm::Id, AuthHelper::IsPreBCAcceptedClientBuild(), RealmBuildInfo::MajorVersion, RealmBuildInfo::MinorVersion, Realm::Name, Realm::PopulationLevel, POST_BC_EXP_FLAG, PRE_BC_EXP_FLAG, realm, RealmHandle::Realm, REALM_FLAG_OFFLINE, REALM_FLAG_SPECIFYBUILD, REALM_LIST, AccountInfo::SecurityLevel, SendPacket(), ByteBuffer::size(), sRealmList, STATUS_AUTHED, Realm::Timezone, and Realm::Type.
Referenced by HandleRealmList().
|
private |
References _accountInfo, _reconnectProof, _sessionKey, _status, ByteBuffer::append(), AUTH_RECONNECT_CHALLENGE, Field::Get(), Acore::Crypto::GetRandomBytes(), AccountInfo::LoadResult(), SendPacket(), SESSION_KEY_LENGTH, STATUS_RECONNECT_PROOF, VersionChallenge, WOW_FAIL_UNKNOWN_ACCOUNT, and WOW_SUCCESS.
Referenced by HandleReconnectChallenge().
void AuthSession::SendPacket | ( | ByteBuffer & | packet | ) |
References ByteBuffer::contents(), ByteBuffer::empty(), Socket< AuthSession >::IsOpen(), Socket< AuthSession >::QueuePacket(), ByteBuffer::size(), and MessageBuffer::Write().
Referenced by CheckIpCallback(), HandleLogonProof(), HandleReconnectProof(), LogonChallengeCallback(), RealmListCallback(), and ReconnectChallengeCallback().
|
overridevirtual |
Implements Socket< AuthSession >.
References _queryProcessor, AsyncCallbackProcessor< T >::AddCallback(), CheckIpCallback(), Socket< AuthSession >::GetRemoteIpAddress(), LOG_TRACE, LOGIN_SEL_IP_INFO, LoginDatabase, and PreparedStatementBase::SetData().
|
overridevirtual |
Reimplemented from Socket< AuthSession >.
References _queryProcessor, AsyncCallbackProcessor< T >::ProcessReadyCallbacks(), and Socket< AuthSession >::Update().
|
private |
References _build, _os, Acore::Impl::GenericHash< HashCreator, DigestLength >::Finalize(), Acore::Impl::GenericHash< HashCreator, DigestLength >::GetDigest(), RealmBuildInfo::MacHash, sConfigMgr, sRealmList, Acore::Impl::GenericHash< HashCreator, DigestLength >::UpdateData(), and RealmBuildInfo::WindowsHash.
Referenced by HandleLogonProof(), and HandleReconnectProof().
|
private |
|
private |
Referenced by HandleLogonChallenge(), HandleReconnectChallenge(), LogonChallengeCallback(), RealmListCallback(), and VerifyVersion().
|
private |
Referenced by HandleLogonChallenge(), HandleLogonProof(), HandleReconnectChallenge(), and RealmListCallback().
|
private |
Referenced by LogonChallengeCallback().
|
private |
Referenced by HandleLogonChallenge(), HandleLogonProof(), HandleReconnectChallenge(), and LogonChallengeCallback().
|
private |
Referenced by HandleLogonChallenge(), HandleLogonProof(), HandleReconnectChallenge(), and VerifyVersion().
|
private |
Referenced by HandleLogonChallenge(), HandleRealmList(), HandleReconnectChallenge(), Start(), and Update().
|
private |
Referenced by HandleReconnectProof(), and ReconnectChallengeCallback().
|
private |
Referenced by HandleLogonProof(), HandleReconnectProof(), and ReconnectChallengeCallback().
|
private |
Referenced by HandleLogonProof(), and LogonChallengeCallback().
|
private |
Referenced by HandleLogonProof(), and LogonChallengeCallback().
std::string AuthSession::Account |
ByteBuffer AuthSession::AddonInfo |
uint32 AuthSession::BattlegroupID = 0 |
uint32 AuthSession::Build = 0 |
Acore::Crypto::SHA1::Digest AuthSession::Digest = {} |
uint64 AuthSession::DosResponse = 0 |
std::array<uint8, 4> AuthSession::LocalChallenge = {} |
uint32 AuthSession::LoginServerID = 0 |
uint32 AuthSession::LoginServerType = 0 |
uint32 AuthSession::RealmID = 0 |
uint32 AuthSession::RegionID = 0 |