From 2fe4ab94c52ad2fa90189ecd9c053da49f06561e Mon Sep 17 00:00:00 2001 From: Gooyeth <566327+Gooyeth@users.noreply.github.com> Date: Fri, 22 Jun 2018 17:32:39 -0600 Subject: Common: Replace ip2nation by ip2location. (#21957) Replace ip2nation by ip2location. Download: https://lite.ip2location.com/database/ip-country --- src/server/authserver/Server/AuthSession.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/server/authserver/Server/AuthSession.cpp') 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()); -- cgit v1.2.3