aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver/Server/AuthSocket.cpp
diff options
context:
space:
mode:
authorNay <dnpd.dd@gmail.com>2012-08-28 14:12:17 +0100
committerNay <dnpd.dd@gmail.com>2012-08-28 14:12:17 +0100
commit449e577b70dab742942eeae2da88973d36048e8b (patch)
treef9e6e2266bc4589f701558b19a2cb70c538fbc0a /src/server/authserver/Server/AuthSocket.cpp
parent9bb198d17037a9b41be09d137bb6237f9acd62c5 (diff)
Core/Authserver: Fix previous merge
Diffstat (limited to 'src/server/authserver/Server/AuthSocket.cpp')
-rw-r--r--src/server/authserver/Server/AuthSocket.cpp81
1 files changed, 58 insertions, 23 deletions
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 793f310f8c1..2ad80c7f62d 100644
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -389,7 +389,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,10 +450,7 @@ bool AuthSocket::_HandleLogonChallenge()
unk3.SetRand(16 * 8);
// Fill the response packet with the result
- // If the client has no valid version
- if (!AuthHelper::IsAcceptedClientBuild(_build))
- pkt << uint8(WOW_FAIL_VERSION_INVALID);
- else
+ if (AuthHelper::IsAcceptedClientBuild(_build))
pkt << uint8(WOW_SUCCESS);
else
pkt << uint8(WOW_FAIL_VERSION_INVALID);
@@ -501,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());
@@ -518,6 +515,15 @@ 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;
@@ -618,14 +624,26 @@ bool AuthSocket::_HandleLogonProof()
sha.UpdateBigNumbers(&A, &M, &K, NULL);
sha.Finalize();
- 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));
+ 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));
+ }
_authed = true;
}
@@ -734,6 +752,7 @@ bool AuthSocket::_HandleReconnectChallenge()
// Reinitialize build, expansion and the account securitylevel
_build = ch->build;
+ _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG));
_os = (const char*)ch->os;
if (_os.size() > 4)
@@ -833,13 +852,15 @@ 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 (i->second.gamebuild != _build)
+ bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild));
+
+ // No SQL injection. id of realm is controlled by the database.
uint32 flag = i->second.flag;
RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(i->second.gamebuild);
if (!okBuild)
{
if (!buildInfo)
- continue;
+ continue;
flag |= REALM_FLAG_OFFLINE | REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for
}
@@ -866,14 +887,18 @@ bool AuthSocket::_HandleRealmList()
AmountOfCharacters = (*result)[0].GetUInt8();
pkt << i->second.icon; // realm type
- pkt << lock; // if 1, then realm locked
+ if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients
+ pkt << lock; // if 1, then realm locked
pkt << uint8(flag); // RealmFlags
pkt << name;
pkt << i->second.address;
pkt << i->second.populationLevel;
pkt << AmountOfCharacters;
pkt << i->second.timezone; // realm category
- pkt << uint8(0x2C); // unk, may be realm number/id?
+ 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
if (_expversion & POST_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD)
{
@@ -886,18 +911,28 @@ bool AuthSocket::_HandleRealmList()
++RealmListSize;
}
- pkt << uint8(0x10);
- pkt << uint8(0x00);
-
+ 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);
+ }
// make a ByteBuffer which stores the RealmList's size
ByteBuffer RealmListSizeBuffer;
RealmListSizeBuffer << uint32(0);
- RealmListSizeBuffer << uint16(RealmListSize);
+ if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients
+ RealmListSizeBuffer << uint16(RealmListSize);
+ else
+ RealmListSizeBuffer << uint32(RealmListSize);
ByteBuffer hdr;
hdr << uint8(REALM_LIST);
- hdr << uint16((pkt.size() + RealmListSizeBuffer.size()));
+ hdr << uint16(pkt.size() + RealmListSizeBuffer.size());
hdr.append(RealmListSizeBuffer); // append RealmList's size buffer
hdr.append(pkt); // append realms in the realmlist