aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-06-08 15:34:24 +0200
committerShauren <shauren.trinity@gmail.com>2014-06-08 15:34:24 +0200
commit9f69eda67f7fad50553f8d569851a5005437e677 (patch)
treeb918ef48a31a1970aad165808be344cf4744ef26
parent05c0524bf3d97ba29496fa13e93acd3b8d7d37a4 (diff)
Core/Battle.net: Additional checks
* Force grunt login for versions < 15595 * Force bn login if supported and game account is linked to bn account
-rw-r--r--sql/base/auth_database.sql6
-rw-r--r--sql/updates/auth/2014_06_08_01_auth_account_434.sql3
-rw-r--r--src/server/authserver/Authentication/AuthCodes.cpp5
-rw-r--r--src/server/authserver/Authentication/AuthCodes.h1
-rw-r--r--src/server/authserver/Server/AuthSocket.cpp4
-rw-r--r--src/server/authserver/Server/BattlenetSocket.cpp8
-rw-r--r--src/server/shared/Database/Implementation/LoginDatabase.cpp2
7 files changed, 19 insertions, 10 deletions
diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql
index 6dca9aa1e14..3ccbadbbda0 100644
--- a/sql/base/auth_database.sql
+++ b/sql/base/auth_database.sql
@@ -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 */;
diff --git a/sql/updates/auth/2014_06_08_01_auth_account_434.sql b/sql/updates/auth/2014_06_08_01_auth_account_434.sql
new file mode 100644
index 00000000000..dc05a98d17b
--- /dev/null
+++ b/sql/updates/auth/2014_06_08_01_auth_account_434.sql
@@ -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;
diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp
index bb278dd6653..7a4998f7028 100644
--- a/src/server/authserver/Authentication/AuthCodes.cpp
+++ b/src/server/authserver/Authentication/AuthCodes.cpp
@@ -79,4 +79,9 @@ namespace AuthHelper
return NULL;
}
+
+ bool IsBuildSupportingBattlenet(int build)
+ {
+ return build >= 15595;
+ }
};
diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h
index 57db55c98a8..a6113b0d26d 100644
--- a/src/server/authserver/Authentication/AuthCodes.h
+++ b/src/server/authserver/Authentication/AuthCodes.h
@@ -182,6 +182,7 @@ namespace AuthHelper
bool IsAcceptedClientBuild(int build);
bool IsPostBCAcceptedClientBuild(int build);
bool IsPreBCAcceptedClientBuild(int build);
+ bool IsBuildSupportingBattlenet(int build);
};
#endif
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 32140f76ba4..7ca49b03b56 100644
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -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);
diff --git a/src/server/authserver/Server/BattlenetSocket.cpp b/src/server/authserver/Server/BattlenetSocket.cpp
index eb8dc1158f0..4ee3c8e9b3d 100644
--- a/src/server/authserver/Server/BattlenetSocket.cpp
+++ b/src/server/authserver/Server/BattlenetSocket.cpp
@@ -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;
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index 1da8088ed36..bccbe41a6ec 100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -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);