* SMSG_AUTH_CHALLENGE should be backwards-compatible now

Auth must be fixed, as the Authentication Methods have changed between major versions
This commit is contained in:
shlainn 2011-09-04 23:37:53 +02:00
parent ddaf7de5d8
commit bee304a453

View File

@ -520,12 +520,17 @@ std::string WorldSession::GetOrRequestPlayerName(uint64 guid)
void WorldSession::_HandleAuthChallengeOpcode(WorldPacket& recvPacket) void WorldSession::_HandleAuthChallengeOpcode(WorldPacket& recvPacket)
{ {
std::string acc = stringToUpper(GetInstance()->GetConf()->accname); //Read Packet
uint32 sp; uint32 sp, serverseed;
if(GetInstance()->GetConf()->clientbuild>6005)//TODO: Check TBC
{
recvPacket >> sp; recvPacket >> sp;
uint32 serverseed; }
recvPacket >> serverseed; recvPacket >> serverseed;
// Do stuff with the data
std::string acc = stringToUpper(GetInstance()->GetConf()->accname);
logdebug("Auth: serverseed=0x%X",serverseed); logdebug("Auth: serverseed=0x%X",serverseed);
Sha1Hash digest; Sha1Hash digest;
digest.UpdateData(acc); digest.UpdateData(acc);
@ -539,11 +544,20 @@ void WorldSession::_HandleAuthChallengeOpcode(WorldPacket& recvPacket)
digest.UpdateData((uint8*)&serverseed,sizeof(uint32)); digest.UpdateData((uint8*)&serverseed,sizeof(uint32));
digest.UpdateBigNumbers(GetInstance()->GetSessionKey(),NULL); digest.UpdateBigNumbers(GetInstance()->GetSessionKey(),NULL);
digest.Finalize(); digest.Finalize();
// Send Reply
WorldPacket auth; WorldPacket auth;
if(GetInstance()->GetConf()->clientbuild<=6005)
{
auth<<(uint32)(GetInstance()->GetConf()->clientbuild)<<unk<<acc<<clientseed_uint32;
auth.append(digest.GetDigest(),20);
}
else
{
auth<<(uint32)(GetInstance()->GetConf()->clientbuild)<<unk<<acc<<unk<<clientseed_uint32<<unk<<unk<<unk<<unk64; auth<<(uint32)(GetInstance()->GetConf()->clientbuild)<<unk<<acc<<unk<<clientseed_uint32<<unk<<unk<<unk<<unk64;
auth.append(digest.GetDigest(),20); auth.append(digest.GetDigest(),20);
}
auth << (uint32)0; // TODO: this is not correct value, expected: 160 bytes of addon_data auth << (uint32)0; // TODO: this is not correct value, expected: 160 bytes of addon_data
auth.SetOpcode(CMSG_AUTH_SESSION); auth.SetOpcode(CMSG_AUTH_SESSION);
SendWorldPacket(auth); SendWorldPacket(auth);
@ -570,7 +584,7 @@ void WorldSession::_HandleAuthResponseOpcode(WorldPacket& recvPacket)
} }
else else
{ {
logerror("World Authentication failed, errcode=0x%X",(unsigned char)errcode); logerror("World Authentication failed, errcode=0x%X",(uint8)errcode);
SetMustDie(); SetMustDie();
} }
} }