Core/Battle.net: Additional checks

* Force grunt login for versions < 15595
* Force bn login if supported and game account is linked to bn account
This commit is contained in:
Shauren
2014-06-08 15:34:24 +02:00
parent 05c0524bf3
commit 9f69eda67f
7 changed files with 19 additions and 10 deletions

View File

@@ -216,18 +216,12 @@ LOCK TABLES `battlenet_components` WRITE;
/*!40000 ALTER TABLE `battlenet_components` DISABLE KEYS */;
INSERT INTO `battlenet_components` VALUES
('Bnet','Cmp1',3),
('Bnet','Win',21719),
('Bnet','Win',26487),
('Bnet','Wn64',26487),
('Tool','Win',1569),
('Tool','Win',2736),
('WoW','base',12340),
('WoW','base',15595),
('WoW','enGB',12340),
('WoW','enGB',15595),
('WoW','enUS',12340),
('WoW','enUS',15595),
('WoW','Win',12340),
('WoW','Win',15595),
('WoW','Wn64',15595);
/*!40000 ALTER TABLE `battlenet_components` ENABLE KEYS */;

View File

@@ -0,0 +1,3 @@
DELETE FROM `battlenet_components` WHERE `Program`='WoW' AND `Build`=12340;
DELETE FROM `battlenet_components` WHERE `Program`='Tool' AND `Build`=1569;
DELETE FROM `battlenet_components` WHERE `Program`='Bnet' AND `Build`=21719;

View File

@@ -79,4 +79,9 @@ namespace AuthHelper
return NULL;
}
bool IsBuildSupportingBattlenet(int build)
{
return build >= 15595;
}
};

View File

@@ -182,6 +182,7 @@ namespace AuthHelper
bool IsAcceptedClientBuild(int build);
bool IsPostBCAcceptedClientBuild(int build);
bool IsPreBCAcceptedClientBuild(int build);
bool IsBuildSupportingBattlenet(int build);
};
#endif

View File

@@ -480,7 +480,9 @@ bool AuthSocket::_HandleLogonChallenge()
unk3.SetRand(16 * 8);
// Fill the response packet with the result
if (AuthHelper::IsAcceptedClientBuild(_build))
if (fields[9].GetUInt32() && AuthHelper::IsBuildSupportingBattlenet(_build))
pkt << uint8(WOW_FAIL_USE_BATTLENET);
else if (AuthHelper::IsAcceptedClientBuild(_build))
pkt << uint8(WOW_SUCCESS);
else
pkt << uint8(WOW_FAIL_VERSION_INVALID);

View File

@@ -107,7 +107,6 @@ void Battlenet::Socket::_SetVSFields(std::string const& pstr)
bool Battlenet::Socket::HandleAuthChallenge(PacketHeader& header, BitStream& packet)
{
// Verify that this IP is not in the ip_banned table
LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS));
@@ -160,7 +159,12 @@ bool Battlenet::Socket::HandleAuthChallenge(PacketHeader& header, BitStream& pac
else if (!sBattlenetMgr->HasPlatform(component.Platform))
complete.SetAuthResult(AUTH_INVALID_OS);
else
complete.SetAuthResult(AUTH_REGION_BAD_VERSION);
{
if (component.Program != "WoW" || AuthHelper::IsBuildSupportingBattlenet(component.Build))
complete.SetAuthResult(AUTH_REGION_BAD_VERSION);
else
complete.SetAuthResult(AUTH_USE_GRUNT_LOGON);
}
Send(complete);
return true;

View File

@@ -37,7 +37,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_SEL_SESSIONKEY, "SELECT a.sessionkey, a.id, aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.sha_pass_hash, a.id, a.locked, a.lock_country, a.last_ip, aa.gmlevel, a.v, a.s, a.token_key FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.sha_pass_hash, a.id, a.locked, a.lock_country, a.last_ip, aa.gmlevel, a.v, a.s, a.token_key, a.battlenet_account FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH);
PrepareStatement(LOGIN_UPD_FAILEDLOGINS, "UPDATE account SET failed_logins = failed_logins + 1 WHERE username = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_FAILEDLOGINS, "SELECT id, failed_logins FROM account WHERE username = ?", CONNECTION_SYNCH);