mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Authserver: Auth cleanup phase 1b, the "I didn't hit Stage All" commit. Sorry. (5e36bf7 follow-up)
This commit is contained in:
@@ -209,7 +209,7 @@ void BigNumber::GetBytes(uint8* buf, size_t bufsize, bool littleEndian) const
|
||||
std::reverse(buf, buf + bufsize);
|
||||
#else
|
||||
int res = littleEndian ? BN_bn2lebinpad(_bn, buf, bufsize) : BN_bn2binpad(_bn, buf, bufsize);
|
||||
ASSERT(res > 0, "Buffer of size %zu is too small to hold bignum with %zu bytes.\n", bufsize, BN_num_bytes(_bn));
|
||||
ASSERT(res > 0, "Buffer of size %zu is too small to hold bignum with %d bytes.\n", bufsize, BN_num_bytes(_bn));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Define.h"
|
||||
#include "Errors.h"
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
@@ -308,6 +309,19 @@ TC_COMMON_API std::string ByteArrayToHexStr(uint8 const* bytes, size_t length, b
|
||||
template <typename Container>
|
||||
std::string ByteArrayToHexStr(Container const& c, bool reverse = false) { return ByteArrayToHexStr(std::data(c), std::size(c), reverse); }
|
||||
TC_COMMON_API void HexStrToByteArray(std::string const& str, uint8* out, bool reverse = false);
|
||||
template <size_t Size>
|
||||
void HexStrToByteArray(std::string const& str, std::array<uint8, Size>& buf, bool reverse = false)
|
||||
{
|
||||
ASSERT(str.size() == (2 * Size));
|
||||
HexStrToByteArray(str, buf.data(), reverse);
|
||||
}
|
||||
template <size_t Size>
|
||||
std::array<uint8, Size> HexStrToByteArray(std::string const& str, bool reverse = false)
|
||||
{
|
||||
std::array<uint8, Size> arr;
|
||||
HexStrToByteArray(str, arr, reverse);
|
||||
return arr;
|
||||
}
|
||||
|
||||
TC_COMMON_API bool StringToBool(std::string const& str);
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ struct AccountInfo
|
||||
// LEFT JOIN account r ON a.id = r.recruiter
|
||||
// WHERE a.username = ? ORDER BY aa.RealmID DESC LIMIT 1
|
||||
Id = fields[0].GetUInt32();
|
||||
HexStrToByteArray(fields[1].GetCString(), SessionKey.data());
|
||||
HexStrToByteArray(fields[1].GetCString(), SessionKey);
|
||||
LastIP = fields[2].GetString();
|
||||
IsLockedToIP = fields[3].GetBool();
|
||||
LockCountry = fields[4].GetString();
|
||||
|
||||
@@ -77,11 +77,11 @@ void RealmList::LoadBuildInfo()
|
||||
build.Build = fields[4].GetUInt32();
|
||||
std::string windowsHash = fields[5].GetString();
|
||||
if (windowsHash.length() == build.WindowsHash.size() * 2)
|
||||
HexStrToByteArray(windowsHash, build.WindowsHash.data());
|
||||
HexStrToByteArray(windowsHash, build.WindowsHash);
|
||||
|
||||
std::string macHash = fields[6].GetString();
|
||||
if (macHash.length() == build.MacHash.size() * 2)
|
||||
HexStrToByteArray(macHash, build.MacHash.data());
|
||||
HexStrToByteArray(macHash, build.MacHash);
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user