mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
feat(Common/IPLocation): replace ip2nation by ip2location (#5653)
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "CryptoHash.h"
|
||||
#include "CryptoRandom.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "IPLocation.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "PacketLog.h"
|
||||
@@ -25,13 +26,13 @@
|
||||
#include "WorldSocket.h"
|
||||
#include "WorldSocketMgr.h"
|
||||
#include <ace/Message_Block.h>
|
||||
#include <ace/OS_NS_string.h>
|
||||
#include <ace/OS_NS_unistd.h>
|
||||
#include <ace/Reactor.h>
|
||||
#include <ace/os_include/arpa/os_inet.h>
|
||||
#include <ace/os_include/netinet/os_tcp.h>
|
||||
#include <ace/os_include/sys/os_socket.h>
|
||||
#include <ace/os_include/sys/os_types.h>
|
||||
#include <ace/OS_NS_string.h>
|
||||
#include <ace/OS_NS_unistd.h>
|
||||
#include <ace/Reactor.h>
|
||||
#include <thread>
|
||||
|
||||
#ifdef ELUNA
|
||||
@@ -921,8 +922,8 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*if (IpLocationRecord const* location = sIPLocation->GetLocationRecord(address))
|
||||
_ipCountry = location->CountryCode;*/
|
||||
if (IpLocationRecord const* location = sIPLocation->GetLocationRecord(address))
|
||||
_ipCountry = location->CountryCode;
|
||||
|
||||
///- Re-check ip locking (same check as in auth).
|
||||
if (account.IsLockedToIP)
|
||||
@@ -938,18 +939,18 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
//else if (!account.LockCountry.empty() && account.LockCountry != "00" && !_ipCountry.empty())
|
||||
//{
|
||||
// if (account.LockCountry != _ipCountry)
|
||||
// {
|
||||
// packet.Initialize(SMSG_AUTH_RESPONSE, 1);
|
||||
// packet << uint8(AUTH_REJECT);
|
||||
// LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: %s, new country: %s).", account.LockCountry.c_str(), _ipCountry.c_str());
|
||||
// // We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
|
||||
// sScriptMgr->OnFailedAccountLogin(account.Id);
|
||||
// return -1;
|
||||
// }
|
||||
//}
|
||||
else if (!account.LockCountry.empty() && account.LockCountry != "00" && !_ipCountry.empty())
|
||||
{
|
||||
if (account.LockCountry != _ipCountry)
|
||||
{
|
||||
packet.Initialize(SMSG_AUTH_RESPONSE, 1);
|
||||
packet << uint8(AUTH_REJECT);
|
||||
LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: %s, new country: %s).", account.LockCountry.c_str(), _ipCountry.c_str());
|
||||
// We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well
|
||||
sScriptMgr->OnFailedAccountLogin(account.Id);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (account.IsBanned)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user