Core/Auth: Refactor client auth key storage to support more future client variants and preserve more information about client version

Port From (https://github.com/TrinityCore/TrinityCore/commit/8e1595265925e0840d07e943b8c9ff1e906d4719)
This commit is contained in:
Hondacrx
2024-10-09 14:28:10 -04:00
parent 71cc76d6b6
commit 37d48ec371
16 changed files with 213 additions and 63 deletions
@@ -5,6 +5,7 @@ using Bgs.Protocol;
using Bgs.Protocol.Authentication.V1;
using Bgs.Protocol.Challenge.V1;
using Framework;
using Framework.ClientBuild;
using Framework.Constants;
using Framework.Database;
using Framework.Realm;
@@ -25,7 +26,7 @@ namespace BNetServer.Networking
return BattlenetRpcErrorCode.BadProgram;
}
if (logonRequest.Platform != "Win" && logonRequest.Platform != "Wn64" && logonRequest.Platform != "Mc64" && logonRequest.Platform != "MacA")
if (!ClientBuildHelper.IsValid(logonRequest.Platform))
{
Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in from an unsupported platform (using {logonRequest.Platform})!");
return BattlenetRpcErrorCode.BadPlatform;
@@ -115,6 +115,8 @@ namespace BNetServer.Networking
int i = 0;
foreach (byte b in realmListTicketClientInformation.Info.Secret)
clientSecret[i++] = b;
_clientInfo = new() { Platform = realmListTicketClientInformation.Info.PlatformType, Arch = realmListTicketClientInformation.Info.ClientArch, Type = realmListTicketClientInformation.Info.Type };
}
}
@@ -227,7 +229,7 @@ namespace BNetServer.Networking
{
Variant realmAddress = Params.LookupByKey("Param_RealmAddress");
if (realmAddress != null)
return Global.RealmMgr.JoinRealm((uint)realmAddress.UintValue, build, GetRemoteIpAddress(), clientSecret, (Locale)Enum.Parse(typeof(Locale), locale), os, _timezoneOffset, gameAccountInfo.Name, gameAccountInfo.SecurityLevel, response);
return Global.RealmMgr.JoinRealm((uint)realmAddress.UintValue, build, _clientInfo, GetRemoteIpAddress(), clientSecret, (Locale)Enum.Parse(typeof(Locale), locale), os, _timezoneOffset, gameAccountInfo.Name, gameAccountInfo.SecurityLevel, response);
return BattlenetRpcErrorCode.WowServicesInvalidJoinTicket;
}