aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-11-02 20:23:39 +0100
committerShauren <shauren.trinity@gmail.com>2015-11-02 20:23:39 +0100
commitc463c843257e30b780ca3ca98f6be47f15a52297 (patch)
treefd07958a86269837edccda96a3f753b6ad73ba04 /src
parentace64a520e1eeeccf314b210504350dc99769252 (diff)
Core/Auth: Added missing lock country check to AuthSession handler
Diffstat (limited to 'src')
-rw-r--r--src/server/database/Database/Implementation/LoginDatabase.cpp2
-rw-r--r--src/server/game/Server/WorldSocket.cpp31
2 files changed, 17 insertions, 16 deletions
diff --git a/src/server/database/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp
index 7e199659177..858268a1157 100644
--- a/src/server/database/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/database/Database/Implementation/LoginDatabase.cpp
@@ -39,7 +39,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME, "SELECT id, username FROM account WHERE username = ?", CONNECTION_SYNCH);
- PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id, a.sessionkey, ba.last_ip, ba.locked, a.expansion, a.mutetime, ba.locale, a.recruiter, ba.os, ba.id, aa.gmLevel, "
+ PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id, a.sessionkey, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, ba.locale, a.recruiter, ba.os, ba.id, aa.gmLevel, "
"bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id "
"FROM account a LEFT JOIN account r ON a.id = r.recruiter LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id "
"LEFT JOIN account_access aa ON a.id = aa.id AND aa.RealmID IN (-1, ?) LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id "
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 6839e5831de..030ca1966f8 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -533,11 +533,11 @@ struct AccountInfo
uint32 Id;
bool IsLockedToIP;
std::string LastIP;
+ std::string LockCountry;
LocaleConstant Locale;
std::string OS;
bool IsBanned;
- std::string LockCountry;
} BattleNet;
struct
@@ -556,9 +556,9 @@ struct AccountInfo
explicit AccountInfo(Field* fields)
{
- // 0 1 2 3 4 5 6 7 8 9 10
- // SELECT a.id, a.sessionkey, ba.last_ip, ba.locked, a.expansion, a.mutetime, ba.locale, a.recruiter, ba.os, ba.id, aa.gmLevel,
- // 11 12 13
+ // 0 1 2 3 4 5 6 7 8 9 10 11
+ // SELECT a.id, a.sessionkey, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, ba.locale, a.recruiter, ba.os, ba.id, aa.gmLevel,
+ // 12 13 14
// bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id
// FROM account a LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id LEFT JOIN account_access aa ON a.id = aa.id AND aa.RealmID IN (-1, ?)
// LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id LEFT JOIN account r ON a.id = r.recruiter
@@ -567,16 +567,17 @@ struct AccountInfo
Game.SessionKey.SetHexStr(fields[1].GetCString());
BattleNet.LastIP = fields[2].GetString();
BattleNet.IsLockedToIP = fields[3].GetBool();
- Game.Expansion = fields[4].GetUInt8();
- Game.MuteTime = fields[5].GetInt64();
- BattleNet.Locale = LocaleConstant(fields[6].GetUInt8());
- Game.Recruiter = fields[7].GetUInt32();
- BattleNet.OS = fields[8].GetString();
- BattleNet.Id = fields[9].GetUInt32();
- Game.Security = AccountTypes(fields[10].GetUInt8());
- BattleNet.IsBanned = fields[11].GetUInt64() != 0;
- Game.IsBanned = fields[12].GetUInt64() != 0;
- Game.IsRectuiter = fields[13].GetUInt32() != 0;
+ BattleNet.LockCountry = fields[4].GetString();
+ Game.Expansion = fields[5].GetUInt8();
+ Game.MuteTime = fields[6].GetInt64();
+ BattleNet.Locale = LocaleConstant(fields[7].GetUInt8());
+ Game.Recruiter = fields[8].GetUInt32();
+ BattleNet.OS = fields[9].GetString();
+ BattleNet.Id = fields[10].GetUInt32();
+ Game.Security = AccountTypes(fields[11].GetUInt8());
+ BattleNet.IsBanned = fields[12].GetUInt64() != 0;
+ Game.IsBanned = fields[13].GetUInt64() != 0;
+ Game.IsRectuiter = fields[14].GetUInt32() != 0;
uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
if (Game.Expansion > world_expansion)
@@ -698,7 +699,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
return;
}
}
- else if (!account.BattleNet.LockCountry.empty() && !_ipCountry.empty())
+ else if (!account.BattleNet.LockCountry.empty() && account.BattleNet.LockCountry != "00" && !_ipCountry.empty())
{
if (account.BattleNet.LockCountry != _ipCountry)
{