aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/authserver')
-rw-r--r--src/server/authserver/Authentication/AuthCodes.cpp20
-rwxr-xr-xsrc/server/authserver/Authentication/AuthCodes.h11
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Server/AuthSocket.cpp99
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.h1
4 files changed, 35 insertions, 96 deletions
diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp
index ace18e7b45c..7a97cbee3de 100644
--- a/src/server/authserver/Authentication/AuthCodes.cpp
+++ b/src/server/authserver/Authentication/AuthCodes.cpp
@@ -19,20 +19,9 @@
namespace AuthHelper
{
- bool IsPreBCAcceptedClientBuild(int build)
- {
- int accepted_versions[] = PRE_BC_ACCEPTED_CLIENT_BUILD;
-
- for (int i = 0; accepted_versions[i]; ++i)
- if (build == accepted_versions[i])
- return true;
-
- return false;
- }
-
- bool IsPostBCAcceptedClientBuild(int build)
+ bool IsAcceptedClientBuild(int build)
{
- int accepted_versions[] = POST_BC_ACCEPTED_CLIENT_BUILD;
+ static int accepted_versions[] = TRINITYCORE_ACCEPTED_CLIENT_BUILD;
for (int i = 0; accepted_versions[i]; ++i)
if (build == accepted_versions[i])
@@ -40,9 +29,4 @@ namespace AuthHelper
return false;
}
-
- bool IsAcceptedClientBuild(int build)
- {
- return (IsPostBCAcceptedClientBuild(build) || IsPreBCAcceptedClientBuild(build));
- }
};
diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h
index f940d459d40..9d631a5800d 100755
--- a/src/server/authserver/Authentication/AuthCodes.h
+++ b/src/server/authserver/Authentication/AuthCodes.h
@@ -65,21 +65,12 @@ enum LoginResult
LOGIN_LOCKED_ENFORCED = 0x10,
};
-#define POST_BC_ACCEPTED_CLIENT_BUILD {12340, 11723, 11403, 11159, 10571, 10505, 10146, 9947, 8606, 0}
-#define PRE_BC_ACCEPTED_CLIENT_BUILD {5875, 6005, 0}
+#define TRINITYCORE_ACCEPTED_CLIENT_BUILD {15595, 12340, 0} // accept one Cataclysm and one Wrath of the Lich King build
-enum ExpansionFlags
-{
- POST_BC_EXP_FLAG = 0x2,
- PRE_BC_EXP_FLAG = 0x1,
- NO_VALID_EXP_FLAG = 0x0
-};
namespace AuthHelper
{
bool IsAcceptedClientBuild(int build);
- bool IsPostBCAcceptedClientBuild(int build);
- bool IsPreBCAcceptedClientBuild(int build);
};
#endif
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 0794d9a802a..c0cf24efbfb 100755..100644
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -343,7 +343,6 @@ bool AuthSocket::_HandleLogonChallenge()
_login = (const char*)ch->I;
_build = ch->build;
- _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG);
_os = (const char*)ch->os;
if (_os.size() > 4)
@@ -352,8 +351,8 @@ bool AuthSocket::_HandleLogonChallenge()
// Restore string order as its byte order is reversed
std::reverse(_os.begin(), _os.end());
- pkt << (uint8)AUTH_LOGON_CHALLENGE;
- pkt << (uint8)0x00;
+ pkt << uint8(AUTH_LOGON_CHALLENGE);
+ pkt << uint8(0x00);
// Verify that this IP is not in the ip_banned table
LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS));
@@ -389,7 +388,7 @@ bool AuthSocket::_HandleLogonChallenge()
if (strcmp(fields[3].GetCString(), ip_address.c_str()))
{
sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP differs");
- pkt << (uint8) WOW_FAIL_SUSPENDED;
+ pkt << uint8(WOW_FAIL_SUSPENDED);
locked = true;
}
else
@@ -450,7 +449,11 @@ bool AuthSocket::_HandleLogonChallenge()
unk3.SetRand(16 * 8);
// Fill the response packet with the result
- pkt << uint8(WOW_SUCCESS);
+ // If the client has no valid version
+ if (!AuthHelper::IsAcceptedClientBuild(_build))
+ pkt << uint8(WOW_FAIL_VERSION_INVALID);
+ else
+ pkt << uint8(WOW_SUCCESS);
// B may be calculated < 32B so we force minimal length to 32B
pkt.append(B.AsByteArray(32), 32); // 32 bytes
@@ -495,7 +498,7 @@ bool AuthSocket::_HandleLogonChallenge()
}
}
else //no account
- pkt << (uint8)WOW_FAIL_UNKNOWN_ACCOUNT;
+ pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT);
}
socket().send((char const*)pkt.contents(), pkt.size());
@@ -512,15 +515,6 @@ bool AuthSocket::_HandleLogonProof()
if (!socket().recv((char *)&lp, sizeof(sAuthLogonProof_C)))
return false;
- // If the client has no valid version
- if (_expversion == NO_VALID_EXP_FLAG)
- {
- // Check if we have the appropriate patch on the disk
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Client with invalid version, patching is not implemented");
- socket().shutdown();
- return true;
- }
-
// Continue the SRP6 calculation based on data received from the client
BigNumber A;
@@ -621,26 +615,14 @@ bool AuthSocket::_HandleLogonProof()
sha.UpdateBigNumbers(&A, &M, &K, NULL);
sha.Finalize();
- if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients
- {
- sAuthLogonProof_S proof;
- memcpy(proof.M2, sha.GetDigest(), 20);
- proof.cmd = AUTH_LOGON_PROOF;
- proof.error = 0;
- proof.unk1 = 0x00800000; // Accountflags. 0x01 = GM, 0x08 = Trial, 0x00800000 = Pro pass (arena tournament)
- proof.unk2 = 0x00; // SurveyId
- proof.unk3 = 0x00;
- socket().send((char *)&proof, sizeof(proof));
- }
- else
- {
- sAuthLogonProof_S_Old proof;
- memcpy(proof.M2, sha.GetDigest(), 20);
- proof.cmd = AUTH_LOGON_PROOF;
- proof.error = 0;
- proof.unk2 = 0x00;
- socket().send((char *)&proof, sizeof(proof));
- }
+ sAuthLogonProof_S proof;
+ memcpy(proof.M2, sha.GetDigest(), 20);
+ proof.cmd = AUTH_LOGON_PROOF;
+ proof.error = 0;
+ proof.unk1 = 0x00800000; // Accountflags. 0x01 = GM, 0x08 = Trial, 0x00800000 = Pro pass (arena tournament)
+ proof.unk2 = 0x00; // SurveyId
+ proof.unk3 = 0x00;
+ socket().send((char *)&proof, sizeof(proof));
_authed = true;
}
@@ -749,7 +731,6 @@ bool AuthSocket::_HandleReconnectChallenge()
// Reinitialize build, expansion and the account securitylevel
_build = ch->build;
- _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG);
_os = (const char*)ch->os;
if (_os.size() > 4)
@@ -766,11 +747,11 @@ bool AuthSocket::_HandleReconnectChallenge()
// Sending response
ByteBuffer pkt;
- pkt << (uint8)AUTH_RECONNECT_CHALLENGE;
- pkt << (uint8)0x00;
+ pkt << uint8(AUTH_RECONNECT_CHALLENGE);
+ pkt << uint8(0x00);
_reconnectProof.SetRand(16 * 8);
pkt.append(_reconnectProof.AsByteArray(16), 16); // 16 bytes random
- pkt << (uint64)0x00 << (uint64)0x00; // 16 bytes zeros
+ pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros
socket().send((char const*)pkt.contents(), pkt.size());
return true;
}
@@ -800,9 +781,9 @@ bool AuthSocket::_HandleReconnectProof()
{
// Sending response
ByteBuffer pkt;
- pkt << (uint8)AUTH_RECONNECT_PROOF;
- pkt << (uint8)0x00;
- pkt << (uint16)0x00; // 2 bytes zeros
+ pkt << uint8(AUTH_RECONNECT_PROOF);
+ pkt << uint8(0x00);
+ pkt << uint16(0x00); // 2 bytes zeros
socket().send((char const*)pkt.contents(), pkt.size());
_authed = true;
return true;
@@ -849,10 +830,8 @@ bool AuthSocket::_HandleRealmList()
for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i)
{
// don't work with realms which not compatible with the client
- if ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild != _build)
+ if (i->second.gamebuild != _build)
continue;
- else if ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild))
- continue;
uint8 AmountOfCharacters;
@@ -869,18 +848,14 @@ bool AuthSocket::_HandleRealmList()
uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
pkt << i->second.icon; // realm type
- if ( _expversion & POST_BC_EXP_FLAG ) // only 2.x and 3.x clients
- pkt << lock; // if 1, then realm locked
+ pkt << lock; // if 1, then realm locked
pkt << uint8(i->second.flag); // RealmFlags
pkt << i->first;
pkt << i->second.address;
pkt << i->second.populationLevel;
pkt << AmountOfCharacters;
pkt << i->second.timezone; // realm category
- if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients
- pkt << (uint8)0x2C; // unk, may be realm number/id?
- else
- pkt << (uint8)0x0; // 1.12.1 and 1.12.2 clients
+ pkt << uint8(0x2C); // unk, may be realm number/id?
if (i->second.flag & REALM_FLAG_SPECIFYBUILD)
{
@@ -894,28 +869,18 @@ bool AuthSocket::_HandleRealmList()
++RealmListSize;
}
- if ( _expversion & POST_BC_EXP_FLAG ) // 2.x and 3.x clients
- {
- pkt << (uint8)0x10;
- pkt << (uint8)0x00;
- }
- else // 1.12.1 and 1.12.2 clients
- {
- pkt << (uint8)0x00;
- pkt << (uint8)0x02;
- }
+ pkt << uint8(0x10);
+ pkt << uint8(0x00);
+
// make a ByteBuffer which stores the RealmList's size
ByteBuffer RealmListSizeBuffer;
RealmListSizeBuffer << (uint32)0;
- if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients
- RealmListSizeBuffer << (uint16)RealmListSize;
- else
- RealmListSizeBuffer << (uint32)RealmListSize;
+ RealmListSizeBuffer << uint16(RealmListSize);
ByteBuffer hdr;
- hdr << (uint8) REALM_LIST;
- hdr << (uint16)(pkt.size() + RealmListSizeBuffer.size());
+ hdr << uint8(REALM_LIST);
+ hdr << uint16((pkt.size() + RealmListSizeBuffer.size()));
hdr.append(RealmListSizeBuffer); // append RealmList's size buffer
hdr.append(pkt); // append realms in the realmlist
diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h
index 9be2136b55c..edd2b345183 100755
--- a/src/server/authserver/Server/AuthSocket.h
+++ b/src/server/authserver/Server/AuthSocket.h
@@ -70,7 +70,6 @@ private:
std::string _localizationName;
std::string _os;
uint16 _build;
- uint8 _expversion;
AccountTypes _accountSecurityLevel;
};