From e9392ad28767626e519c463e2110184d71ba8426 Mon Sep 17 00:00:00 2001 From: Treeston Date: Sun, 26 Jul 2020 01:53:34 +0200 Subject: Core/Authserver: Authserver cleanup (PR#25093) - Fix a handful of 1/256 bugs with most significant byte zero in BigNumber - Get rid of (most of) the C-style arrays in authserver - CryptoRandom as a unified source for cryptographic randomness - Bring our other crypto APIs into 2020 - BigNumber usability improvements - Authserver is now actually readable as a result of all of the above (cherry picked from commit 210176fd915cf4ba16f428d3c1a249a71f4aa7a7) --- src/server/scripts/Commands/cs_battlenet_account.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Commands/cs_battlenet_account.cpp b/src/server/scripts/Commands/cs_battlenet_account.cpp index a1166a6c3c9..fc7e8948382 100644 --- a/src/server/scripts/Commands/cs_battlenet_account.cpp +++ b/src/server/scripts/Commands/cs_battlenet_account.cpp @@ -17,8 +17,8 @@ #include "AccountMgr.h" #include "BattlenetAccountMgr.h" -#include "BigNumber.h" #include "Chat.h" +#include "CryptoRandom.h" #include "DatabaseEnv.h" #include "IpAddress.h" #include "IPLocation.h" @@ -425,10 +425,9 @@ public: std::string accountName = std::to_string(accountId) + '#' + std::to_string(uint32(index)); // Generate random hex string for password, these accounts must not be logged on with GRUNT - BigNumber randPassword; - randPassword.SetRand(8 * 16); + std::array randPassword = Trinity::Crypto::GetRandomBytes<16>(); - switch (sAccountMgr->CreateAccount(accountName, ByteArrayToHexStr(randPassword.AsByteArray().get(), randPassword.GetNumBytes()), bnetAccountName, accountId, index)) + switch (sAccountMgr->CreateAccount(accountName, ByteArrayToHexStr(randPassword), bnetAccountName, accountId, index)) { case AccountOpResult::AOR_OK: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName.c_str()); -- cgit v1.2.3