Negative mutetime indicates amount of seconds to be muted effective on next login - which is now.
675 TC_LOG_ERROR(
"network",
"WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
685 HmacSha256 hmac(SHA256_DIGEST_LENGTH, account.Game.SessionKey.AsByteArray(SHA256_DIGEST_LENGTH).get());
686 hmac.
UpdateData(authSession->LocalChallenge.data(), authSession->LocalChallenge.size());
692 if (memcmp(hmac.GetDigest(), authSession->Digest.data(), authSession->Digest.size()) != 0)
694 TC_LOG_ERROR(
"network",
"WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", account.Game.Id, authSession->RealmJoinTicket.c_str(), address.c_str());
699 HmacSha256 sessionKeyHmac(SHA256_DIGEST_LENGTH, account.Game.SessionKey.AsByteArray(SHA256_DIGEST_LENGTH).get());
701 sessionKeyHmac.UpdateData(authSession->LocalChallenge.data(), authSession->LocalChallenge.size());
703 sessionKeyHmac.Finalize();
705 uint8 sessionKey[40];
707 sessionKeyGenerator.
Generate(sessionKey, 40);
717 stmt->
setString(1, authSession->RealmJoinTicket);
738 TC_LOG_ERROR(
"network",
"WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.",
746 if (wardenActive && account.Game.OS !=
"Win" && account.Game.OS !=
"Wn64" && account.Game.OS !=
"Mc64")
749 TC_LOG_ERROR(
"network",
"WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), account.Game.OS.c_str());
755 if (account.BattleNet.IsLockedToIP)
757 if (account.BattleNet.LastIP != address)
760 TC_LOG_DEBUG(
"network",
"WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", account.BattleNet.LastIP.c_str(), address.c_str());
762 sScriptMgr->OnFailedAccountLogin(account.Game.Id);
767 else if (!account.BattleNet.LockCountry.empty() && account.BattleNet.LockCountry !=
"00" && !
_ipCountry.empty())
769 if (account.BattleNet.LockCountry !=
_ipCountry)
772 TC_LOG_DEBUG(
"network",
"WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: %s, new country: %s).", account.BattleNet.LockCountry.c_str(),
_ipCountry.c_str());
774 sScriptMgr->OnFailedAccountLogin(account.Game.Id);
780 int64 mutetime = account.Game.MuteTime;
792 if (account.IsBanned())
795 TC_LOG_ERROR(
"network",
"WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
796 sScriptMgr->OnFailedAccountLogin(account.Game.Id);
803 TC_LOG_DEBUG(
"network",
"Allowed Level: %u Player Level %u", allowedAccountType, account.Game.Security);
804 if (allowedAccountType >
SEC_PLAYER && account.Game.Security < allowedAccountType)
807 TC_LOG_DEBUG(
"network",
"WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
808 sScriptMgr->OnFailedAccountLogin(account.Game.Id);
813 TC_LOG_DEBUG(
"network",
"WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", authSession->RealmJoinTicket.c_str(), address.c_str());
819 stmt->setString(1, authSession->RealmJoinTicket);
827 _worldSession =
new WorldSession(account.Game.Id, std::move(authSession->RealmJoinTicket), account.BattleNet.Id, shared_from_this(), account.Game.Security,
828 account.Game.Expansion, mutetime, account.Game.OS, account.BattleNet.Locale, account.Game.Recruiter, account.Game.IsRectuiter);
Definition: BigNumber.h:28
uint32 Realm
Definition: Realm.h:53
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void SendAuthResponseError(uint32 code)
Definition: WorldSocket.cpp:948
Definition: WorldSocket.cpp:593
void Generate(uint8 *buf, uint32 sz)
Definition: SessionKeyGeneration.h:49
PreparedQueryResultFuture LoadPermissionsAsync()
Definition: WorldSession.cpp:1104
int64_t int64
Definition: Define.h:145
BigNumber _serverChallenge
Definition: WorldSocket.h:139
std::function< void(PreparedQueryResult &&)> _queryCallback
Definition: WorldSocket.h:158
Realm realm
Definition: World.cpp:3485
Definition: LoginDatabase.h:73
boost::asio::ip::address GetRemoteIpAddress() const
Definition: Socket.h:99
void ReadAddonsInfo(ByteBuffer &data)
Definition: WorldSession.cpp:822
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SessionKeyGeneration.h:25
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
void Init(BigNumber *K) override
Definition: WorldPacketCrypt.cpp:29
void SetBinary(uint8 const *bytes, int32 len)
Definition: BigNumber.cpp:57
#define sWorld
Definition: World.h:887
Definition: HmacHash.h:34
WorldSession * _worldSession
Definition: WorldSocket.h:148
Definition: PreparedStatement.h:74
void LoadSessionPermissionsCallback(PreparedQueryResult result)
Definition: WorldSocket.cpp:840
Definition: LoginDatabase.h:40
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
static uint8 const AuthCheckSeed[16]
Definition: WorldSocket.h:77
void DelayedCloseSocket()
Marks the socket for closing after write buffer becomes empty.
Definition: Socket.h:157
Battlenet::RealmHandle Id
Definition: Realm.h:86
std::string AsHexStr() const
Definition: BigNumber.cpp:198
AccountTypes
Definition: Common.h:106
void setInt64(const uint8 index, const int64 value)
Definition: PreparedStatement.cpp:160
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void UpdateData(std::string const &str)
Definition: HmacHash.cpp:38
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
static uint8 const SessionKeySeed[16]
Definition: WorldSocket.h:78
Definition: LoginDatabase.h:71
bool _authed
Definition: WorldSocket.h:149
WorldPacketCrypt _authCrypt
Definition: WorldSocket.h:140
std::unique_ptr< uint8[]> AsByteArray(int32 minSize=0, bool littleEndian=true)
Definition: BigNumber.cpp:177
uint8_t uint8
Definition: Define.h:152
std::string _ipCountry
Definition: WorldSocket.h:159
void InitWarden(BigNumber *k)
Definition: WorldSession.cpp:1075
Definition: BattlenetRpcErrorCodes.h:28
#define sScriptMgr
Definition: ScriptMgr.h:837
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Player session in the World.
Definition: WorldSession.h:882
void AsyncRead()
Definition: Socket.h:109
PreparedQueryResultFuture _queryFuture
Definition: WorldSocket.h:157
Definition: LoginDatabase.h:72
#define llabs
Definition: Common.h:79