aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/bnetserver/Server/Session.cpp22
-rw-r--r--src/server/bnetserver/Server/Session.h1
-rw-r--r--src/server/database/Database/Implementation/LoginDatabase.cpp2
-rw-r--r--src/server/game/Server/WorldSocket.cpp12
4 files changed, 21 insertions, 16 deletions
diff --git a/src/server/bnetserver/Server/Session.cpp b/src/server/bnetserver/Server/Session.cpp
index d1106f7a42b..55a6827854a 100644
--- a/src/server/bnetserver/Server/Session.cpp
+++ b/src/server/bnetserver/Server/Session.cpp
@@ -52,11 +52,12 @@ void Battlenet::Session::AccountInfo::LoadResult(PreparedQueryResult result)
void Battlenet::Session::GameAccountInfo::LoadResult(Field* fields)
{
- // a.id, a.username, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, aa.gmlevel
+ // a.id, a.username, ab.unbandate, ab.unbandate = ab.bandate, aa.gmlevel
Id = fields[0].GetUInt32();
Name = fields[1].GetString();
- IsBanned = fields[2].GetUInt64() != 0;
- IsPermanenetlyBanned = fields[3].GetUInt64() != 0;
+ UnbanDate = fields[2].GetUInt32();
+ IsPermanenetlyBanned = fields[3].GetUInt32() != 0;
+ IsBanned = IsPermanenetlyBanned || UnbanDate > time(nullptr);
SecurityLevel = AccountTypes(fields[4].GetUInt8());
std::size_t hashPos = Name.find('#');
@@ -371,12 +372,9 @@ uint32 Battlenet::Session::VerifyWebCredentials(std::string const& webCredential
logonResult.mutable_account_id()->set_high(UI64LIT(0x100000000000000));
for (auto itr = _accountInfo->GameAccounts.begin(); itr != _accountInfo->GameAccounts.end(); ++itr)
{
- if (!itr->second.IsBanned)
- {
- EntityId* gameAccountId = logonResult.add_game_account_id();
- gameAccountId->set_low(itr->second.Id);
- gameAccountId->set_high(UI64LIT(0x200000200576F57));
- }
+ EntityId* gameAccountId = logonResult.add_game_account_id();
+ gameAccountId->set_low(itr->second.Id);
+ gameAccountId->set_high(UI64LIT(0x200000200576F57));
}
if (!_ipCountry.empty())
@@ -436,6 +434,7 @@ uint32 Battlenet::Session::HandleGetGameAccountState(account::v1::GetGameAccount
{
response->mutable_state()->mutable_game_status()->set_is_suspended(itr->second.IsBanned);
response->mutable_state()->mutable_game_status()->set_is_banned(itr->second.IsPermanenetlyBanned);
+ response->mutable_state()->mutable_game_status()->set_suspension_expires(uint64(itr->second.UnbanDate) * 1000000);
}
response->mutable_state()->mutable_game_status()->set_program(5730135); // WoW
@@ -508,6 +507,11 @@ uint32 Battlenet::Session::GetRealmListTicket(std::unordered_map<std::string, Va
if (!_gameAccountInfo)
return ERROR_UTIL_SERVER_INVALID_IDENTITY_ARGS;
+ if (_gameAccountInfo->IsPermanenetlyBanned)
+ return ERROR_GAME_ACCOUNT_BANNED;
+ else if (_gameAccountInfo->IsBanned)
+ return ERROR_GAME_ACCOUNT_SUSPENDED;
+
bool clientInfoOk = false;
if (Variant const* clientInfo = GetParam(params, "Param_ClientInfo"))
{
diff --git a/src/server/bnetserver/Server/Session.h b/src/server/bnetserver/Server/Session.h
index 88fd5c36cca..22b9e0a7b44 100644
--- a/src/server/bnetserver/Server/Session.h
+++ b/src/server/bnetserver/Server/Session.h
@@ -99,6 +99,7 @@ namespace Battlenet
uint32 Id;
std::string Name;
std::string DisplayName;
+ uint32 UnbanDate;
bool IsBanned;
bool IsPermanenetlyBanned;
AccountTypes SecurityLevel;
diff --git a/src/server/database/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp
index 782e128258d..04aa0578403 100644
--- a/src/server/database/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/database/Database/Implementation/LoginDatabase.cpp
@@ -117,7 +117,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_DEL_ACCOUNT_MUTED, "DELETE FROM account_muted WHERE guid = ?", CONNECTION_ASYNC);
#define BnetAccountInfo "ba.id, UPPER(ba.email), ba.locked, ba.lock_country, ba.last_ip, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, bab.unbandate = bab.bandate"
-#define BnetGameAccountInfo "a.id, a.username, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, aa.gmlevel"
+#define BnetGameAccountInfo "a.id, a.username, ab.unbandate, ab.unbandate = ab.bandate, aa.gmlevel"
PrepareStatement(LOGIN_SEL_BNET_AUTHENTICATION, "SELECT ba.id, ba.sha_pass_hash, ba.failed_logins, ba.LoginTicket, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id WHERE email = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_BNET_AUTHENTICATION, "UPDATE battlenet_accounts SET LoginTicket = ?, LoginTicketExpiry = ? WHERE id = ?", CONNECTION_ASYNC);
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 95848c9eb7c..d35d5f78298 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -633,8 +633,8 @@ struct AccountInfo
Game.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;
+ BattleNet.IsBanned = fields[12].GetUInt32() != 0;
+ Game.IsBanned = fields[13].GetUInt32() != 0;
Game.IsRectuiter = fields[14].GetUInt32() != 0;
if (BattleNet.Locale >= TOTAL_LOCALES)
@@ -754,7 +754,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
{
if (account.BattleNet.LastIP != address)
{
- SendAuthResponseError(ERROR_DENIED);
+ SendAuthResponseError(ERROR_RISK_ACCOUNT_LOCKED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", account.BattleNet.LastIP.c_str(), address.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.Game.Id);
@@ -766,7 +766,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
{
if (account.BattleNet.LockCountry != _ipCountry)
{
- SendAuthResponseError(ERROR_DENIED);
+ SendAuthResponseError(ERROR_RISK_ACCOUNT_LOCKED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account country differs. Original country: %s, new country: %s).", account.BattleNet.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.Game.Id);
@@ -789,7 +789,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
if (account.IsBanned())
{
- SendAuthResponseError(ERROR_DENIED);
+ SendAuthResponseError(ERROR_GAME_ACCOUNT_BANNED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
sScriptMgr->OnFailedAccountLogin(account.Game.Id);
DelayedCloseSocket();
@@ -801,7 +801,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
TC_LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, account.Game.Security);
if (allowedAccountType > SEC_PLAYER && account.Game.Security < allowedAccountType)
{
- SendAuthResponseError(ERROR_DENIED);
+ SendAuthResponseError(ERROR_SERVER_IS_PRIVATE);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
sScriptMgr->OnFailedAccountLogin(account.Game.Id);
DelayedCloseSocket();