aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver/Server/AuthSession.cpp
diff options
context:
space:
mode:
authorGooyeth <566327+Gooyeth@users.noreply.github.com>2018-06-22 17:32:39 -0600
committerAokromes <Aokromes@users.noreply.github.com>2018-06-23 01:32:39 +0200
commit2fe4ab94c52ad2fa90189ecd9c053da49f06561e (patch)
treed505bd2176de8a659401c1b87694ca20c96bedb3 /src/server/authserver/Server/AuthSession.cpp
parent0dcc318e377138dcbc116b5703d7dc1bffc0cc0f (diff)
Common: Replace ip2nation by ip2location. (#21957)
Replace ip2nation by ip2location. Download: https://lite.ip2location.com/database/ip-country
Diffstat (limited to 'src/server/authserver/Server/AuthSession.cpp')
-rw-r--r--src/server/authserver/Server/AuthSession.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp
index 8cfe4c50c1a..648296b620b 100644
--- a/src/server/authserver/Server/AuthSession.cpp
+++ b/src/server/authserver/Server/AuthSession.cpp
@@ -20,6 +20,7 @@
#include "AuthCodes.h"
#include "Config.h"
#include "Errors.h"
+#include "IPLocation.h"
#include "Log.h"
#include "DatabaseEnv.h"
#include "RealmList.h"
@@ -169,7 +170,6 @@ void AuthSession::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(&AuthSession::CheckIpCallback, this, std::placeholders::_1)));
}
@@ -195,9 +195,6 @@ void AuthSession::CheckIpCallback(PreparedQueryResult result)
if (fields[0].GetUInt64() != 0)
banned = true;
- if (!fields[1].GetString().empty())
- _ipCountry = fields[1].GetString();
-
} while (result->NextRow());
if (banned)
@@ -344,6 +341,9 @@ void AuthSession::LogonChallengeCallback(PreparedQueryResult result)
}
else
{
+ if (IpLocationRecord* location = sIPLocation->GetData(ipAddress))
+ _ipCountry = location->country_code;
+
TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to ip", _accountInfo.Login.c_str());
if (_accountInfo.LockCountry.empty() || _accountInfo.LockCountry == "00")
TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to country", _accountInfo.Login.c_str());