aboutsummaryrefslogtreecommitdiff
path: root/src/server/bnetserver/Server/Session.cpp
diff options
context:
space:
mode:
authorGooyeth <566327+Gooyeth@users.noreply.github.com>2018-06-22 17:32:39 -0600
committerShauren <shauren.trinity@gmail.com>2019-01-09 17:35:13 +0100
commit163c487be7e60ab0488dade3e3170c9b7b9b5f68 (patch)
treec4c299c869d543f9f04d683987ad74a033963285 /src/server/bnetserver/Server/Session.cpp
parent5620eb9463a8d6cf59851306b92a8c644acd512d (diff)
Common: Replace ip2nation by ip2location. (#21957)
Replace ip2nation by ip2location. Download: https://lite.ip2location.com/database/ip-country (cherry picked from commit 2fe4ab94c52ad2fa90189ecd9c053da49f06561e)
Diffstat (limited to 'src/server/bnetserver/Server/Session.cpp')
-rw-r--r--src/server/bnetserver/Server/Session.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/bnetserver/Server/Session.cpp b/src/server/bnetserver/Server/Session.cpp
index bc70b8ba9fb..56c71a3eeb6 100644
--- a/src/server/bnetserver/Server/Session.cpp
+++ b/src/server/bnetserver/Server/Session.cpp
@@ -20,6 +20,7 @@
#include "ByteConverter.h"
#include "DatabaseEnv.h"
#include "Errors.h"
+#include "IPLocation.h"
#include "QueryCallback.h"
#include "LoginRESTService.h"
#include "ProtobufJSON.h"
@@ -92,7 +93,6 @@ void Battlenet::Session::Start()
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_INFO);
stmt->setString(0, ip_address);
- stmt->setUInt32(1, inet_addr(ip_address.c_str()));
_queryProcessor.AddQuery(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&Battlenet::Session::CheckIpCallback, this, std::placeholders::_1)));
}
@@ -108,9 +108,6 @@ void Battlenet::Session::CheckIpCallback(PreparedQueryResult result)
if (fields[0].GetUInt64() != 0)
banned = true;
- if (!fields[1].GetString().empty())
- _ipCountry = fields[1].GetString();
-
} while (result->NextRow());
if (banned)
@@ -339,6 +336,9 @@ uint32 Battlenet::Session::VerifyWebCredentials(std::string const& webCredential
}
else
{
+ if (IpLocationRecord* location = sIPLocation->GetData(ip_address))
+ _ipCountry = location->country_code;
+
TC_LOG_DEBUG("session", "[Session::HandleVerifyWebCredentials] Account '%s' is not locked to ip", _accountInfo->Login.c_str());
if (_accountInfo->LockCountry.empty() || _accountInfo->LockCountry == "00")
TC_LOG_DEBUG("session", "[Session::HandleVerifyWebCredentials] Account '%s' is not locked to country", _accountInfo->Login.c_str());