mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-13 23:43:44 +00:00
refactor(Core/Misc): acore to Acore (#6043)
This commit is contained in:
@@ -28,7 +28,7 @@ DBCDatabaseLoader::DBCDatabaseLoader(char const* tableName, char const* dbcForma
|
||||
|
||||
char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||
{
|
||||
std::string query = acore::StringFormat("SELECT * FROM `%s` ORDER BY `ID` DESC", _sqlTableName);
|
||||
std::string query = Acore::StringFormat("SELECT * FROM `%s` ORDER BY `ID` DESC", _sqlTableName);
|
||||
|
||||
// no error if empty set
|
||||
QueryResult result = WorldDatabase.Query(query.c_str());
|
||||
|
||||
@@ -26,8 +26,8 @@ class AsyncAcceptor
|
||||
public:
|
||||
typedef void(*AcceptCallback)(tcp::socket&& newSocket, uint32 threadIndex);
|
||||
|
||||
AsyncAcceptor(acore::Asio::IoContext& ioContext, std::string const& bindIp, uint16 port) :
|
||||
_acceptor(ioContext), _endpoint(acore::Net::make_address(bindIp), port),
|
||||
AsyncAcceptor(Acore::Asio::IoContext& ioContext, std::string const& bindIp, uint16 port) :
|
||||
_acceptor(ioContext), _endpoint(Acore::Net::make_address(bindIp), port),
|
||||
_socket(ioContext), _closed(false), _socketFactory(std::bind(&AsyncAcceptor::DefeaultSocketFactory, this))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -158,9 +158,9 @@ private:
|
||||
std::mutex _newSocketsLock;
|
||||
SocketContainer _newSockets;
|
||||
|
||||
acore::Asio::IoContext _ioContext;
|
||||
Acore::Asio::IoContext _ioContext;
|
||||
tcp::socket _acceptSocket;
|
||||
acore::Asio::DeadlineTimer _updateTimer;
|
||||
Acore::Asio::DeadlineTimer _updateTimer;
|
||||
};
|
||||
|
||||
#endif // NetworkThread_h__
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
ASSERT(!_threads && !_acceptor && !_threadCount, "StopNetwork must be called prior to SocketMgr destruction");
|
||||
}
|
||||
|
||||
virtual bool StartNetwork(acore::Asio::IoContext& ioContext, std::string const& bindIp, uint16 port, int threadCount)
|
||||
virtual bool StartNetwork(Acore::Asio::IoContext& ioContext, std::string const& bindIp, uint16 port, int threadCount)
|
||||
{
|
||||
ASSERT(threadCount > 0);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size, si
|
||||
|
||||
ByteBufferInvalidValueException::ByteBufferInvalidValueException(char const* type, char const* value)
|
||||
{
|
||||
message().assign(acore::StringFormat("Invalid %s value (%s) found in ByteBuffer", type, value));
|
||||
message().assign(Acore::StringFormat("Invalid %s value (%s) found in ByteBuffer", type, value));
|
||||
}
|
||||
|
||||
ByteBuffer& ByteBuffer::operator>>(float& value)
|
||||
|
||||
@@ -111,7 +111,7 @@ void SecretMgr::AttemptLoad(Secrets i, LogLevel errorLevel, std::unique_lock<std
|
||||
// verify digest
|
||||
if (
|
||||
((!oldDigest) != (!currentValue)) || // there is an old digest, but no current secret (or vice versa)
|
||||
(oldDigest && !acore::Crypto::Argon2::Verify(currentValue->AsHexStr(), *oldDigest)) // there is an old digest, and the current secret does not match it
|
||||
(oldDigest && !Acore::Crypto::Argon2::Verify(currentValue->AsHexStr(), *oldDigest)) // there is an old digest, and the current secret does not match it
|
||||
)
|
||||
{
|
||||
if (info.owner != THIS_SERVER_PROCESS)
|
||||
@@ -128,7 +128,7 @@ void SecretMgr::AttemptLoad(Secrets i, LogLevel errorLevel, std::unique_lock<std
|
||||
if (oldDigest && info.oldKey) // there is an old digest, so there might be an old secret (if possible)
|
||||
{
|
||||
oldSecret = GetHexFromConfig(info.oldKey, info.bits);
|
||||
if (oldSecret && !acore::Crypto::Argon2::Verify(oldSecret->AsHexStr(), *oldDigest))
|
||||
if (oldSecret && !Acore::Crypto::Argon2::Verify(oldSecret->AsHexStr(), *oldDigest))
|
||||
{
|
||||
LOG_MESSAGE_BODY("server.loading", errorLevel, "Invalid value for '%s' specified - this is not actually the secret previously used in your auth DB.", info.oldKey);
|
||||
_secrets[i].state = Secret::LOAD_FAILED;
|
||||
@@ -178,15 +178,15 @@ Optional<std::string> SecretMgr::AttemptTransition(Secrets i, Optional<BigNumber
|
||||
if (hadOldSecret)
|
||||
{
|
||||
if (!oldSecret)
|
||||
return acore::StringFormat("Cannot decrypt old TOTP tokens - add config key '%s' to authserver.conf!", secret_info[i].oldKey);
|
||||
return Acore::StringFormat("Cannot decrypt old TOTP tokens - add config key '%s' to authserver.conf!", secret_info[i].oldKey);
|
||||
|
||||
bool success = acore::Crypto::AEDecrypt<acore::Crypto::AES>(totpSecret, oldSecret->ToByteArray<acore::Crypto::AES::KEY_SIZE_BYTES>());
|
||||
bool success = Acore::Crypto::AEDecrypt<Acore::Crypto::AES>(totpSecret, oldSecret->ToByteArray<Acore::Crypto::AES::KEY_SIZE_BYTES>());
|
||||
if (!success)
|
||||
return acore::StringFormat("Cannot decrypt old TOTP tokens - value of '%s' is incorrect for some users!", secret_info[i].oldKey);
|
||||
return Acore::StringFormat("Cannot decrypt old TOTP tokens - value of '%s' is incorrect for some users!", secret_info[i].oldKey);
|
||||
}
|
||||
|
||||
if (newSecret)
|
||||
acore::Crypto::AEEncryptWithRandomIV<acore::Crypto::AES>(totpSecret, newSecret->ToByteArray<acore::Crypto::AES::KEY_SIZE_BYTES>());
|
||||
Acore::Crypto::AEEncryptWithRandomIV<Acore::Crypto::AES>(totpSecret, newSecret->ToByteArray<Acore::Crypto::AES::KEY_SIZE_BYTES>());
|
||||
|
||||
auto* updateStmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_TOTP_SECRET);
|
||||
updateStmt->setBinary(0, totpSecret);
|
||||
@@ -211,7 +211,7 @@ Optional<std::string> SecretMgr::AttemptTransition(Secrets i, Optional<BigNumber
|
||||
{
|
||||
BigNumber salt;
|
||||
salt.SetRand(128);
|
||||
Optional<std::string> hash = acore::Crypto::Argon2::Hash(newSecret->AsHexStr(), salt);
|
||||
Optional<std::string> hash = Acore::Crypto::Argon2::Hash(newSecret->AsHexStr(), salt);
|
||||
if (!hash)
|
||||
return std::string("Failed to hash new secret");
|
||||
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
|
||||
#include "SharedDefines.h"
|
||||
|
||||
ServerProcessTypes acore::Impl::CurrentServerProcessHolder::_type = NUM_SERVER_PROCESS_TYPES;
|
||||
ServerProcessTypes Acore::Impl::CurrentServerProcessHolder::_type = NUM_SERVER_PROCESS_TYPES;
|
||||
|
||||
@@ -3575,7 +3575,7 @@ enum ServerProcessTypes
|
||||
NUM_SERVER_PROCESS_TYPES
|
||||
};
|
||||
|
||||
namespace acore::Impl
|
||||
namespace Acore::Impl
|
||||
{
|
||||
struct AC_SHARED_API CurrentServerProcessHolder
|
||||
{
|
||||
@@ -3584,6 +3584,6 @@ namespace acore::Impl
|
||||
};
|
||||
}
|
||||
|
||||
#define THIS_SERVER_PROCESS (acore::Impl::CurrentServerProcessHolder::type())
|
||||
#define THIS_SERVER_PROCESS (Acore::Impl::CurrentServerProcessHolder::type())
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user