Core/Realms: Move build info (and auth seeds) to database

This commit is contained in:
Shauren
2019-12-07 13:02:10 +01:00
parent 16321877f6
commit 61f2eed353
5 changed files with 278 additions and 39 deletions
+12 -6
View File
@@ -25,7 +25,7 @@
#include "HmacHash.h"
#include "IPLocation.h"
#include "PacketLog.h"
#include "Realm.h"
#include "RealmList.h"
#include "RBAC.h"
#include "ScriptMgr.h"
#include "SessionKeyGeneration.h"
@@ -69,9 +69,6 @@ uint8 const WorldSocket::SessionKeySeed[16] = { 0x58, 0xCB, 0xCF, 0x40, 0xFE, 0x
uint8 const WorldSocket::ContinuedSessionSeed[16] = { 0x16, 0xAD, 0x0C, 0xD4, 0x46, 0xF9, 0x4F, 0xB2, 0xEF, 0x7D, 0xEA, 0x2A, 0x17, 0x66, 0x4D, 0x2F };
uint8 const WorldSocket::EncryptionKeySeed[16] = { 0xE9, 0x75, 0x3C, 0x50, 0x90, 0x93, 0x61, 0xDA, 0x3B, 0x07, 0xEE, 0xFA, 0xFF, 0x9D, 0x41, 0xB8 };
uint8 const ClientTypeSeed_Wn64[16] = { 0x1A, 0x09, 0xBE, 0x1D, 0x38, 0xA1, 0x22, 0x58, 0x6B, 0x49, 0x31, 0xBE, 0xCC, 0xEA, 0xD4, 0xAA };
uint8 const ClientTypeSeed_Mc64[16] = { 0x34, 0x1C, 0xFE, 0xFE, 0x3D, 0x72, 0xAC, 0xA9, 0xA4, 0x40, 0x7D, 0xC5, 0x35, 0xDE, 0xD6, 0x6A };
WorldSocket::WorldSocket(tcp::socket&& socket) : Socket(std::move(socket)),
_type(CONNECTION_TYPE_REALM), _key(0), _OverSpeedPings(0),
_worldSession(nullptr), _authed(false), _sendBufferSize(4096), _compressionStream(nullptr)
@@ -671,6 +668,15 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
return;
}
RealmBuildInfo const* buildInfo = sRealmList->GetBuildInfo(realm.Build);
if (!buildInfo)
{
SendAuthResponseError(ERROR_BAD_VERSION);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Missing auth seed for realm build %u (%s).", realm.Build, GetRemoteIpAddress().to_string().c_str());
DelayedCloseSocket();
return;
}
AccountInfo account(result->Fetch());
// For hook purposes, we get Remoteaddress at this point.
@@ -679,9 +685,9 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
SHA256Hash digestKeyHash;
digestKeyHash.UpdateData(account.Game.KeyData.data(), account.Game.KeyData.size());
if (account.Game.OS == "Wn64")
digestKeyHash.UpdateData(ClientTypeSeed_Wn64, 16);
digestKeyHash.UpdateData(buildInfo->Win64AuthSeed.data(), buildInfo->Win64AuthSeed.size());
else if (account.Game.OS == "Mc64")
digestKeyHash.UpdateData(ClientTypeSeed_Mc64, 16);
digestKeyHash.UpdateData(buildInfo->Mac64AuthSeed.data(), buildInfo->Mac64AuthSeed.size());
digestKeyHash.Finalize();