Core/Authserver: Re-organize the accounts table (PR #25135)
- no longer use sha_pass_hash for anything else core-side (.account, SOAP, RA) - salt/verifier/session_key are now binary - old s/v/sha_pass_hash fields kept around for backwards compatibility - sha_pass_hash is still updated (for now), s/v are not - sha_pass_hash is only read if s/v have been manually changed - SRP6 b now uses the full 32 bytes of randomness (instead of randomly only using 19) (cherry picked from commit 3164b58c7d170810b69378950c0891e5f5b8678b)
This commit is contained in:
@@ -618,15 +618,15 @@ struct AccountInfo
|
||||
|
||||
explicit AccountInfo(Field* fields)
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
// SELECT a.id, a.sessionkey, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, ba.locale, a.recruiter, a.os, ba.id, aa.SecurityLevel,
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
// SELECT a.id, a.session_key, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, ba.locale, a.recruiter, a.os, ba.id, aa.SecurityLevel,
|
||||
// 12 13 14
|
||||
// bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id
|
||||
// FROM account a LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?)
|
||||
// LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id LEFT JOIN account r ON a.id = r.recruiter
|
||||
// WHERE a.username = ? ORDER BY aa.RealmID DESC LIMIT 1
|
||||
// WHERE a.username = ? AND LENGTH(a.session_key) = 40 ORDER BY aa.RealmID DESC LIMIT 1
|
||||
Game.Id = fields[0].GetUInt32();
|
||||
HexStrToByteArray(fields[1].GetString(), Game.KeyData.data());
|
||||
Game.KeyData = fields[1].GetBinary<64>();
|
||||
BattleNet.LastIP = fields[2].GetString();
|
||||
BattleNet.IsLockedToIP = fields[3].GetBool();
|
||||
BattleNet.LockCountry = fields[4].GetString();
|
||||
@@ -734,7 +734,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
|
||||
// This also allows to check for possible "hack" attempts on account
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_INFO_CONTINUED_SESSION);
|
||||
stmt->setString(0, ByteArrayToHexStr(_sessionKey));
|
||||
stmt->setBinary(0, _sessionKey);
|
||||
stmt->setUInt32(1, account.Game.Id);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
@@ -896,7 +896,7 @@ void WorldSocket::HandleAuthContinuedSessionCallback(std::shared_ptr<WorldPacket
|
||||
uint32 accountId = uint32(key.Fields.AccountId);
|
||||
Field* fields = result->Fetch();
|
||||
std::string login = fields[0].GetString();
|
||||
HexStrToByteArray(fields[1].GetString(), _sessionKey.data());
|
||||
_sessionKey = fields[1].GetBinary<SESSION_KEY_LENGTH>();
|
||||
|
||||
Trinity::Crypto::HMAC_SHA256 hmac(_sessionKey);
|
||||
hmac.UpdateData(reinterpret_cast<uint8 const*>(&authSession->Key), sizeof(authSession->Key));
|
||||
|
||||
Reference in New Issue
Block a user