![]() |
TrinityCore
|
#include <AuthSession.h>
Inheritance diagram for AuthSession:Public Member Functions | |
| AuthSession (Trinity::Net::IoContextTcpSocket &&socket) | |
| void | Start () override |
| bool | Update () override |
| void | SendPacket (ByteBuffer &packet) |
| Trinity::Net::SocketReadCallbackResult | ReadHandler () override |
| void | QueueQuery (QueryCallback &&queryCallback) |
Public Member Functions inherited from Trinity::Net::Socket< Stream > | |
| template<typename... Args> | |
| Socket (IoContextTcpSocket &&socket, Args &&... args) | |
| template<typename... Args> | |
| Socket (boost::asio::io_context &context, Args &&... args) | |
| Socket (Socket const &other)=delete | |
| Socket (Socket &&other)=delete | |
| Socket & | operator= (Socket const &other)=delete |
| Socket & | operator= (Socket &&other)=delete |
| virtual | ~Socket () |
| boost::asio::ip::address const & | GetRemoteIpAddress () const |
| uint16 | GetRemotePort () const |
| template<SocketReadCallback Callback> | |
| void | AsyncRead (Callback &&callback) |
| void | QueuePacket (MessageBuffer &&buffer) |
| bool | IsOpen () const |
| void | CloseSocket () |
| void | DelayedCloseSocket () |
| Marks the socket for closing after write buffer becomes empty. | |
| MessageBuffer & | GetReadBuffer () |
| Stream & | underlying_stream () |
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 |
| Trinity::Crypto::SHA1::Digest | Digest = {} |
| std::string | Account |
| ByteBuffer | AddonInfo |
Private Types | |
| using | AuthSocket = Socket |
Private Member Functions | |
| bool | HandleLogonChallenge () |
| bool | HandleLogonProof () |
| bool | HandleReconnectChallenge () |
| bool | HandleReconnectProof () |
| bool | HandleRealmList () |
| bool | HandleXferAccept () |
| bool | HandleXferResume () |
| bool | HandleXferCancel () |
| void | LogonChallengeCallback (PreparedQueryResult result) |
| void | ReconnectChallengeCallback (PreparedQueryResult result) |
| void | RealmListCallback (PreparedQueryResult result) |
| bool | VerifyVersion (std::span< uint8 const > a, Trinity::Crypto::SHA1::Digest const &versionProof, bool isReconnect) |
| void | SetTimeout () |
Private Attributes | |
| friend | AuthHandlerTable |
| Optional< Trinity::Crypto::SRP6 > | _srp6 |
| SessionKey | _sessionKey = {} |
| std::array< uint8, 16 > | _reconnectProof = {} |
| Trinity::Asio::DeadlineTimer | _timeout |
| AuthStatus | _status |
| AccountInfo | _accountInfo |
| Optional< std::vector< uint8 > > | _totpSecret |
| LocaleConstant | _locale |
| uint32 | _os |
| std::string_view | _ipCountry |
| uint16 | _build |
| uint8 | _expversion |
| Minutes | _timezoneOffset |
| QueryCallbackProcessor | _queryProcessor |
Additional Inherited Members | |
Protected Member Functions inherited from Trinity::Net::Socket< Stream > | |
| virtual void | OnClose () |
| bool | AsyncProcessQueue () |
| void | SetNoDelay (bool enable) |
Definition at line 64 of file AuthSession.h.
|
private |
Definition at line 66 of file AuthSession.h.
| AuthSession::AuthSession | ( | Trinity::Net::IoContextTcpSocket && | socket | ) |
Definition at line 201 of file AuthSession.cpp.
|
private |
Definition at line 292 of file AuthSession.cpp.
References _build, _expversion, _locale, _os, _status, _timezoneOffset, AUTH_LOGON_CHALLENGE_INITIAL_SIZE, AUTH_LOGON_CHALLENGE_C::build, AUTH_LOGON_CHALLENGE_C::country, GetLocaleByName(), AUTH_LOGON_CHALLENGE_C::GetLogin(), Trinity::Net::Socket< Stream >::GetReadBuffer(), MessageBuffer::GetReadPointer(), AUTH_LOGON_CHALLENGE_C::I_len, AuthHelper::IsPostBCAcceptedClientBuild(), AuthHelper::IsPreBCAcceptedClientBuild(), LOGIN_SEL_LOGONCHALLENGE, LoginDatabase, NO_VALID_EXP_FLAG, AUTH_LOGON_CHALLENGE_C::os, POST_BC_EXP_FLAG, PRE_BC_EXP_FLAG, QueueQuery(), PreparedStatementBase::setStringView(), AUTH_LOGON_CHALLENGE_C::size, STATUS_CLOSED, TC_LOG_DEBUG, AUTH_LOGON_CHALLENGE_C::timezone_bias, and ClientBuild::ToCharArray().
Referenced by AuthHandlerTable::AuthHandlerTable().
|
private |
Definition at line 458 of file AuthSession.cpp.
References _accountInfo, _expversion, _locale, _os, _sessionKey, _srp6, _status, _timezoneOffset, _totpSecret, AUTH_LOGON_PROOF_C::A, AUTH_LOGON_PROOF, AUTH_LOGON_PROOF_C::clientM, AUTH_LOGON_PROOF_C::crc_hash, Trinity::Net::Socket< Stream >::GetReadBuffer(), MessageBuffer::GetReadPointer(), Trinity::Net::Socket< Stream >::GetRemoteIpAddress(), Trinity::Net::Socket< Stream >::GetRemotePort(), Trinity::Crypto::SRP6::GetSessionVerifier(), AccountInfo::Login, LOGIN_UPD_LOGONPROOF, LoginDatabase, NO_VALID_EXP_FLAG, QueueQuery(), MessageBuffer::ReadCompleted(), sConfigMgr, AUTH_LOGON_PROOF_C::securityFlags, SendPacket(), PreparedStatementBase::setBinary(), PreparedStatementBase::setInt16(), PreparedStatementBase::setString(), PreparedStatementBase::setStringView(), PreparedStatementBase::setUInt32(), STATUS_AUTHED, STATUS_CLOSED, TC_LOG_DEBUG, ClientBuild::ToCharArray(), Trinity::Crypto::TOTP::ValidateToken(), VerifyVersion(), WOW_FAIL_UNKNOWN_ACCOUNT, and WOW_FAIL_VERSION_INVALID.
Referenced by AuthHandlerTable::AuthHandlerTable().
|
private |
Definition at line 721 of file AuthSession.cpp.
References _accountInfo, _status, AccountInfo::Id, LOGIN_SEL_REALM_CHARACTER_COUNTS, LoginDatabase, QueueQuery(), RealmListCallback(), PreparedStatementBase::setUInt32(), STATUS_WAITING_FOR_REALM_LIST, and TC_LOG_DEBUG.
Referenced by AuthHandlerTable::AuthHandlerTable().
|
private |
Definition at line 623 of file AuthSession.cpp.
References _build, _expversion, _locale, _os, _status, _timezoneOffset, AUTH_LOGON_CHALLENGE_INITIAL_SIZE, AUTH_LOGON_CHALLENGE_C::build, AUTH_LOGON_CHALLENGE_C::country, GetLocaleByName(), AUTH_LOGON_CHALLENGE_C::GetLogin(), Trinity::Net::Socket< Stream >::GetReadBuffer(), MessageBuffer::GetReadPointer(), AUTH_LOGON_CHALLENGE_C::I_len, AuthHelper::IsPostBCAcceptedClientBuild(), AuthHelper::IsPreBCAcceptedClientBuild(), LOGIN_SEL_RECONNECTCHALLENGE, LoginDatabase, NO_VALID_EXP_FLAG, AUTH_LOGON_CHALLENGE_C::os, POST_BC_EXP_FLAG, PRE_BC_EXP_FLAG, QueueQuery(), PreparedStatementBase::setStringView(), AUTH_LOGON_CHALLENGE_C::size, STATUS_CLOSED, TC_LOG_DEBUG, AUTH_LOGON_CHALLENGE_C::timezone_bias, and ClientBuild::ToCharArray().
Referenced by AuthHandlerTable::AuthHandlerTable().
|
private |
Definition at line 676 of file AuthSession.cpp.
References _accountInfo, _reconnectProof, _sessionKey, _status, AUTH_RECONNECT_PROOF, Trinity::Impl::GenericHash< HashCreator, DigestLength >::Finalize(), Trinity::Impl::GenericHash< HashCreator, DigestLength >::GetDigest(), Trinity::Net::Socket< Stream >::GetReadBuffer(), MessageBuffer::GetReadPointer(), Trinity::Net::Socket< Stream >::GetRemoteIpAddress(), Trinity::Net::Socket< Stream >::GetRemotePort(), AccountInfo::Login, AUTH_RECONNECT_PROOF_C::R1, AUTH_RECONNECT_PROOF_C::R2, AUTH_RECONNECT_PROOF_C::R3, SendPacket(), STATUS_AUTHED, STATUS_CLOSED, TC_LOG_DEBUG, TC_LOG_ERROR, Trinity::Impl::GenericHash< HashCreator, DigestLength >::UpdateData(), VerifyVersion(), WOW_FAIL_VERSION_INVALID, and WOW_SUCCESS.
Referenced by AuthHandlerTable::AuthHandlerTable().
|
private |
Definition at line 829 of file AuthSession.cpp.
References TC_LOG_DEBUG.
Referenced by AuthHandlerTable::AuthHandlerTable().
|
private |
Definition at line 845 of file AuthSession.cpp.
References TC_LOG_DEBUG.
Referenced by AuthHandlerTable::AuthHandlerTable().
|
private |
Definition at line 837 of file AuthSession.cpp.
References TC_LOG_DEBUG.
Referenced by AuthHandlerTable::AuthHandlerTable().
|
private |
Definition at line 319 of file AuthSession.cpp.
References _accountInfo, _build, _ipCountry, _locale, _srp6, _status, _totpSecret, ByteBuffer::append(), AUTH_LOGON_CHALLENGE, Field::GetBinary(), Trinity::Net::Socket< Stream >::GetRemoteIpAddress(), Trinity::Net::Socket< Stream >::GetRemotePort(), AuthHelper::IsAcceptedClientBuild(), AccountInfo::IsBanned, AccountInfo::IsLockedToIP, AccountInfo::IsPermanenetlyBanned, AccountInfo::LastIP, AccountInfo::LoadResult(), localeNames, AccountInfo::LockCountry, AccountInfo::Login, Trinity::Crypto::SRP6::SALT_LENGTH, SECRET_TOTP_MASTER_KEY, SendPacket(), sIPLocation, sSecretMgr, STATUS_LOGON_PROOF, TC_LOG_DEBUG, TC_LOG_ERROR, TC_LOG_INFO, Trinity::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.
| void AuthSession::QueueQuery | ( | QueryCallback && | queryCallback | ) |
Definition at line 274 of file AuthSession.cpp.
References _queryProcessor, and AsyncCallbackProcessor< T >::AddCallback().
Referenced by HandleLogonChallenge(), HandleLogonProof(), HandleRealmList(), and HandleReconnectChallenge().
|
overridevirtual |
Reimplemented from Trinity::Net::Socket< Stream >.
Definition at line 230 of file AuthSession.cpp.
References _status, AUTH_LOGON_CHALLENGE, AUTH_RECONNECT_CHALLENGE, Trinity::Net::Socket< Stream >::CloseSocket(), MessageBuffer::GetActiveSize(), Trinity::Net::Socket< Stream >::GetReadBuffer(), MessageBuffer::GetReadPointer(), AuthHandler::handler, Handlers, Trinity::Net::KeepReading, MAX_ACCEPTED_CHALLENGE_SIZE, AuthHandler::packetSize, MessageBuffer::ReadCompleted(), SetTimeout(), AUTH_LOGON_CHALLENGE_C::size, AuthHandler::status, and Trinity::Net::Stop.
|
private |
Definition at line 733 of file AuthSession.cpp.
References _accountInfo, _build, _expversion, _status, Realm::AllowedSecurityLevel, ByteBuffer::append(), ClientBuild::Info::BugfixVersion, ClientBuild::Info::Build, Realm::Build, Realm::Flags, Realm::GetAddressForClient(), ClientBuild::GetBuildInfo(), Trinity::Net::Socket< Stream >::GetRemoteIpAddress(), Field::GetUInt32(), Field::GetUInt8(), Realm::Id, AuthHelper::IsPreBCAcceptedClientBuild(), ClientBuild::Info::MajorVersion, ClientBuild::Info::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, Trinity::StringFormatTo(), Realm::Timezone, and Realm::Type.
Referenced by HandleRealmList().
|
private |
Definition at line 650 of file AuthSession.cpp.
References _accountInfo, _reconnectProof, _sessionKey, _status, ByteBuffer::append(), AUTH_RECONNECT_CHALLENGE, Field::GetBinary(), Trinity::Crypto::GetRandomBytes(), AccountInfo::LoadResult(), SendPacket(), SESSION_KEY_LENGTH, STATUS_RECONNECT_PROOF, VersionChallenge, WOW_FAIL_UNKNOWN_ACCOUNT, and WOW_SUCCESS.
| void AuthSession::SendPacket | ( | ByteBuffer & | packet | ) |
Definition at line 279 of file AuthSession.cpp.
References ByteBuffer::contents(), ByteBuffer::empty(), Trinity::Net::Socket< Stream >::IsOpen(), Trinity::Net::Socket< Stream >::QueuePacket(), ByteBuffer::size(), and MessageBuffer::Write().
Referenced by HandleLogonProof(), HandleReconnectProof(), LogonChallengeCallback(), RealmListCallback(), and ReconnectChallengeCallback().
|
private |
Definition at line 883 of file AuthSession.cpp.
References _status, _timeout, STATUS_AUTHED, STATUS_WAITING_FOR_REALM_LIST, STATUS_XFER, and TC_LOG_DEBUG.
Referenced by ReadHandler(), and Start().
|
overridevirtual |
Reimplemented from Trinity::Net::Socket< Stream >.
Definition at line 207 of file AuthSession.cpp.
References SetTimeout(), Trinity::Net::SocketConnectionInitializer::SetupChain(), and Trinity::Net::ReadConnectionInitializer< SocketType >::Start().
|
overridevirtual |
Reimplemented from Trinity::Net::Socket< Stream >.
Definition at line 220 of file AuthSession.cpp.
References _queryProcessor, and AsyncCallbackProcessor< T >::ProcessReadyCallbacks().
|
private |
Definition at line 853 of file AuthSession.cpp.
References _build, _os, ClientBuild::Info::ExecutableHashes, Trinity::Impl::GenericHash< HashCreator, DigestLength >::Finalize(), ClientBuild::GetBuildInfo(), Trinity::Impl::GenericHash< HashCreator, DigestLength >::GetDigest(), ClientBuild::ExecutableHash::Platform, sConfigMgr, and Trinity::Impl::GenericHash< HashCreator, DigestLength >::UpdateData().
Referenced by HandleLogonProof(), and HandleReconnectProof().
|
private |
Definition at line 104 of file AuthSession.h.
Referenced by HandleLogonProof(), HandleRealmList(), HandleReconnectProof(), LogonChallengeCallback(), RealmListCallback(), and ReconnectChallengeCallback().
|
private |
Definition at line 109 of file AuthSession.h.
Referenced by HandleLogonChallenge(), HandleReconnectChallenge(), LogonChallengeCallback(), RealmListCallback(), and VerifyVersion().
|
private |
Definition at line 110 of file AuthSession.h.
Referenced by HandleLogonChallenge(), HandleLogonProof(), HandleReconnectChallenge(), and RealmListCallback().
|
private |
Definition at line 108 of file AuthSession.h.
Referenced by LogonChallengeCallback().
|
private |
Definition at line 106 of file AuthSession.h.
Referenced by HandleLogonChallenge(), HandleLogonProof(), HandleReconnectChallenge(), and LogonChallengeCallback().
|
private |
Definition at line 107 of file AuthSession.h.
Referenced by HandleLogonChallenge(), HandleLogonProof(), HandleReconnectChallenge(), and VerifyVersion().
|
private |
Definition at line 113 of file AuthSession.h.
Referenced by QueueQuery(), and Update().
|
private |
Definition at line 100 of file AuthSession.h.
Referenced by HandleReconnectProof(), and ReconnectChallengeCallback().
|
private |
Definition at line 99 of file AuthSession.h.
Referenced by HandleLogonProof(), HandleReconnectProof(), and ReconnectChallengeCallback().
|
private |
Definition at line 98 of file AuthSession.h.
Referenced by HandleLogonProof(), and LogonChallengeCallback().
|
private |
Definition at line 103 of file AuthSession.h.
Referenced by HandleLogonChallenge(), HandleLogonProof(), HandleRealmList(), HandleReconnectChallenge(), HandleReconnectProof(), LogonChallengeCallback(), ReadHandler(), RealmListCallback(), ReconnectChallengeCallback(), and SetTimeout().
|
private |
Definition at line 102 of file AuthSession.h.
Referenced by SetTimeout().
|
private |
Definition at line 111 of file AuthSession.h.
Referenced by HandleLogonChallenge(), HandleLogonProof(), and HandleReconnectChallenge().
Definition at line 105 of file AuthSession.h.
Referenced by HandleLogonProof(), and LogonChallengeCallback().
| std::string AuthSession::Account |
Definition at line 241 of file WorldSocket.cpp.
| ByteBuffer AuthSession::AddonInfo |
Definition at line 242 of file WorldSocket.cpp.
|
private |
Definition at line 81 of file AuthSession.h.
| uint32 AuthSession::BattlegroupID = 0 |
Definition at line 232 of file WorldSocket.cpp.
| uint32 AuthSession::Build = 0 |
Definition at line 235 of file WorldSocket.cpp.
| Trinity::Crypto::SHA1::Digest AuthSession::Digest = {} |
Definition at line 240 of file WorldSocket.cpp.
| uint64 AuthSession::DosResponse = 0 |
Definition at line 239 of file WorldSocket.cpp.
| std::array<uint8, 4> AuthSession::LocalChallenge = {} |
Definition at line 236 of file WorldSocket.cpp.
| uint32 AuthSession::LoginServerID = 0 |
Definition at line 237 of file WorldSocket.cpp.
| uint32 AuthSession::LoginServerType = 0 |
Definition at line 233 of file WorldSocket.cpp.
| uint32 AuthSession::RealmID = 0 |
Definition at line 234 of file WorldSocket.cpp.
| uint32 AuthSession::RegionID = 0 |
Definition at line 238 of file WorldSocket.cpp.