mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core: Added 4.3.4 opcodes from WPP, commented out some code to fix compile (switches with opcodes - duplicate case 0: labels) and fixed authentication
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
namespace AuthHelper
|
||||
{
|
||||
bool IsAcceptedBuild(int build)
|
||||
bool IsAcceptedClientBuild(int build)
|
||||
{
|
||||
static int accepted_versions[] = TRINITYCORE_ACCEPTED_CLIENT_BUILD;
|
||||
|
||||
@@ -29,9 +29,4 @@ namespace AuthHelper
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsAcceptedClientBuild(int build)
|
||||
{
|
||||
return (IsAcceptedBuild(build));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,13 +65,12 @@ enum LoginResult
|
||||
LOGIN_LOCKED_ENFORCED = 0x10,
|
||||
};
|
||||
|
||||
#define TRINITYCORE_ACCEPTED_CLIENT_BUILD {14545, 14480, 14333, 14007, 0}
|
||||
#define TRINITYCORE_ACCEPTED_CLIENT_BUILD {15595, 12340, 0} // accept one Cataclysm and one Wrath of the Lich King build
|
||||
|
||||
|
||||
namespace AuthHelper
|
||||
{
|
||||
bool IsAcceptedClientBuild(int build);
|
||||
bool IsAcceptedBuild(int build);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,21 +19,26 @@
|
||||
#include "WorldSession.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
void WorldSession::SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos)
|
||||
void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
|
||||
{
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1 + 4 + 1 + 4 + 1 + (shortForm ? 0 : (4 + 1)));
|
||||
packet << uint8(code);
|
||||
packet << uint32(0); // BillingTimeRemaining
|
||||
packet << uint8(0); // BillingPlanFlags
|
||||
packet << uint32(0); // BillingTimeRested
|
||||
packet << uint8(Expansion()); // 0 - normal, 1 - TBC, 2 - WOTLK, 3 - CATA; must be set in database manually for each account
|
||||
packet << uint8(Expansion()); // Unknown, these two show the same
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1 /*bits*/ + 4 + 1 + 4 + 1 + 4 + 1 + 1 + (queued ? 4 : 0));
|
||||
packet.WriteBit(queued);
|
||||
if (queued)
|
||||
packet.WriteBit(0);
|
||||
|
||||
if (!shortForm)
|
||||
{
|
||||
packet.WriteBit(1); // has account info
|
||||
|
||||
// account info
|
||||
packet << uint32(0); // BillingTimeRemaining
|
||||
packet << uint8(Expansion()); // 0 - normal, 1 - TBC, 2 - WOTLK, 3 - CATA; must be set in database manually for each account
|
||||
packet << uint32(0);
|
||||
packet << uint8(Expansion()); // Unknown, these two show the same
|
||||
packet << uint32(0); // BillingTimeRested
|
||||
packet << uint8(0); // BillingPlanFlags
|
||||
|
||||
packet << uint8(code);
|
||||
if (queued)
|
||||
packet << uint32(queuePos); // Queue position
|
||||
packet << uint8(0); // Unk 3.3.0
|
||||
}
|
||||
|
||||
SendPacket(&packet);
|
||||
}
|
||||
|
||||
@@ -91,15 +91,15 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
case CMSG_MESSAGECHAT_AFK:
|
||||
type = CHAT_MSG_AFK;
|
||||
break;
|
||||
case CMSG_MESSAGECHAT_DND:
|
||||
type = CHAT_MSG_DND;
|
||||
break;
|
||||
case CMSG_MESSAGECHAT_EMOTE:
|
||||
type = CHAT_MSG_EMOTE;
|
||||
break;
|
||||
case CMSG_MESSAGECHAT_PARTY:
|
||||
type = CHAT_MSG_PARTY;
|
||||
break;
|
||||
//case CMSG_MESSAGECHAT_DND:
|
||||
// type = CHAT_MSG_DND;
|
||||
// break;
|
||||
//case CMSG_MESSAGECHAT_EMOTE:
|
||||
// type = CHAT_MSG_EMOTE;
|
||||
// break;
|
||||
//case CMSG_MESSAGECHAT_PARTY:
|
||||
// type = CHAT_MSG_PARTY;
|
||||
// break;
|
||||
//case CMSG_MESSAGECHAT_PARTY_LEADER:
|
||||
// type = CHAT_MSG_PARTY_LEADER;
|
||||
// break;
|
||||
@@ -139,7 +139,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
if (type != CHAT_MSG_EMOTE)
|
||||
{
|
||||
recvData >> lang;
|
||||
|
||||
|
||||
// prevent talking at unknown language (cheating)
|
||||
LanguageDesc const* langDesc = GetLanguageDescByID(lang);
|
||||
if (!langDesc)
|
||||
@@ -542,7 +542,7 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recvData)
|
||||
{
|
||||
Player* sender = GetPlayer();
|
||||
ChatMsg type;
|
||||
|
||||
|
||||
switch (recvData.GetOpcode())
|
||||
{
|
||||
case CMSG_MESSAGECHAT_ADDON_BATTLEGROUND:
|
||||
@@ -554,12 +554,12 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recvData)
|
||||
case CMSG_MESSAGECHAT_ADDON_PARTY:
|
||||
type = CHAT_MSG_PARTY;
|
||||
break;
|
||||
case CMSG_MESSAGECHAT_ADDON_RAID:
|
||||
type = CHAT_MSG_RAID;
|
||||
break;
|
||||
case CMSG_MESSAGECHAT_ADDON_WHISPER:
|
||||
type = CHAT_MSG_WHISPER;
|
||||
break;
|
||||
//case CMSG_MESSAGECHAT_ADDON_RAID:
|
||||
// type = CHAT_MSG_RAID;
|
||||
// break;
|
||||
//case CMSG_MESSAGECHAT_ADDON_WHISPER:
|
||||
// type = CHAT_MSG_WHISPER;
|
||||
// break;
|
||||
default:
|
||||
sLog->outDetail("HandleAddonMessagechatOpcode: Unknown addon chat opcode (%u)", recvData.GetOpcode());
|
||||
recvData.hexlike();
|
||||
@@ -624,7 +624,7 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recvData)
|
||||
case CHAT_MSG_PARTY:
|
||||
case CHAT_MSG_RAID:
|
||||
{
|
||||
|
||||
|
||||
Group* group = sender->GetGroup();
|
||||
if (!group || group->isBGGroup())
|
||||
break;
|
||||
|
||||
@@ -426,15 +426,15 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
case CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break;
|
||||
case CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break;
|
||||
case CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK: move_type = MOVE_RUN_BACK; force_move_type = MOVE_RUN_BACK; break;
|
||||
case CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = MOVE_SWIM; force_move_type = MOVE_SWIM; break;
|
||||
case CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: move_type = MOVE_SWIM_BACK; force_move_type = MOVE_SWIM_BACK; break;
|
||||
case CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK: move_type = MOVE_TURN_RATE; force_move_type = MOVE_TURN_RATE; break;
|
||||
case CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT; force_move_type = MOVE_FLIGHT; break;
|
||||
case CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break;
|
||||
case CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break;
|
||||
//case CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break;
|
||||
//case CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break;
|
||||
//case CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK: move_type = MOVE_RUN_BACK; force_move_type = MOVE_RUN_BACK; break;
|
||||
//case CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = MOVE_SWIM; force_move_type = MOVE_SWIM; break;
|
||||
//case CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: move_type = MOVE_SWIM_BACK; force_move_type = MOVE_SWIM_BACK; break;
|
||||
//case CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK: move_type = MOVE_TURN_RATE; force_move_type = MOVE_TURN_RATE; break;
|
||||
//case CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT; force_move_type = MOVE_FLIGHT; break;
|
||||
//case CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break;
|
||||
//case CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break;
|
||||
default:
|
||||
sLog->outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
|
||||
return;
|
||||
|
||||
@@ -67,7 +67,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
|
||||
recv_data.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
switch (recv_data.GetOpcode())
|
||||
{
|
||||
case CMSG_REQUEST_VEHICLE_PREV_SEAT:
|
||||
@@ -122,7 +122,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
|
||||
|
||||
@@ -1325,46 +1325,46 @@ MovementStatusElements* GetMovementStatusElementsSequence(Opcodes opcode)
|
||||
{
|
||||
switch(opcode)
|
||||
{
|
||||
case SMSG_PLAYER_MOVE://done
|
||||
return PlayerMoveSequence;
|
||||
case MSG_MOVE_FALL_LAND://done
|
||||
return MovementFallLandSequence;
|
||||
case MSG_MOVE_HEARTBEAT://done
|
||||
return MovementHeartBeatSequence;
|
||||
case MSG_MOVE_JUMP://done
|
||||
return MovementJumpSequence;
|
||||
case MSG_MOVE_SET_FACING://done
|
||||
return MovementSetFacingSequence;
|
||||
case MSG_MOVE_SET_PITCH://done
|
||||
return MovementSetPitchSequence;
|
||||
case MSG_MOVE_START_BACKWARD://done
|
||||
return MovementStartBackwardSequence;
|
||||
case MSG_MOVE_START_FORWARD://done
|
||||
return MovementStartForwardSequence;
|
||||
case MSG_MOVE_START_STRAFE_LEFT://done
|
||||
return MovementStartStrafeLeftSequence;
|
||||
case MSG_MOVE_START_STRAFE_RIGHT://done
|
||||
return MovementStartStrafeRightSequence;
|
||||
case MSG_MOVE_START_TURN_LEFT://done
|
||||
return MovementStartTurnLeftSequence;
|
||||
case MSG_MOVE_START_TURN_RIGHT://done
|
||||
return MovementStartTurnRightSequence;
|
||||
case MSG_MOVE_STOP://done
|
||||
return MovementStopSequence;
|
||||
case MSG_MOVE_STOP_STRAFE://done
|
||||
return MovementStopStrafeSequence;
|
||||
case MSG_MOVE_STOP_TURN://done
|
||||
return MovementStopTurnSequence;
|
||||
case MSG_MOVE_START_ASCEND://done
|
||||
return MovementStartAscendSequence;
|
||||
case MSG_MOVE_START_DESCEND://done
|
||||
return MovementStartDescendSequence;
|
||||
case MSG_MOVE_START_SWIM://done
|
||||
return MovementStartSwimSequence;
|
||||
case MSG_MOVE_STOP_ASCEND://done
|
||||
return MovementStopAscendSequence;
|
||||
default:
|
||||
break;
|
||||
case SMSG_PLAYER_MOVE:
|
||||
return PlayerMoveSequence;
|
||||
case MSG_MOVE_FALL_LAND:
|
||||
return MovementFallLandSequence;
|
||||
//case MSG_MOVE_HEARTBEAT:
|
||||
// return MovementHeartBeatSequence;
|
||||
case MSG_MOVE_JUMP:
|
||||
return MovementJumpSequence;
|
||||
//case MSG_MOVE_SET_FACING:
|
||||
// return MovementSetFacingSequence;
|
||||
//case MSG_MOVE_SET_PITCH:
|
||||
// return MovementSetPitchSequence;
|
||||
case MSG_MOVE_START_BACKWARD:
|
||||
return MovementStartBackwardSequence;
|
||||
case MSG_MOVE_START_FORWARD:
|
||||
return MovementStartForwardSequence;
|
||||
case MSG_MOVE_START_STRAFE_LEFT:
|
||||
return MovementStartStrafeLeftSequence;
|
||||
case MSG_MOVE_START_STRAFE_RIGHT:
|
||||
return MovementStartStrafeRightSequence;
|
||||
case MSG_MOVE_START_TURN_LEFT:
|
||||
return MovementStartTurnLeftSequence;
|
||||
case MSG_MOVE_START_TURN_RIGHT:
|
||||
return MovementStartTurnRightSequence;
|
||||
case MSG_MOVE_STOP:
|
||||
return MovementStopSequence;
|
||||
case MSG_MOVE_STOP_STRAFE:
|
||||
return MovementStopStrafeSequence;
|
||||
case MSG_MOVE_STOP_TURN:
|
||||
return MovementStopTurnSequence;
|
||||
case MSG_MOVE_START_ASCEND:
|
||||
return MovementStartAscendSequence;
|
||||
case MSG_MOVE_START_DESCEND:
|
||||
return MovementStartDescendSequence;
|
||||
case MSG_MOVE_START_SWIM:
|
||||
return MovementStartSwimSequence;
|
||||
case MSG_MOVE_STOP_ASCEND:
|
||||
return MovementStopAscendSequence;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -634,15 +634,19 @@ void WorldSession::SendAuthWaitQue(uint32 position)
|
||||
if (position == 0)
|
||||
{
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
|
||||
packet.WriteBit(0); // has queue info
|
||||
packet.WriteBit(0); // has account info
|
||||
packet << uint8(AUTH_OK);
|
||||
SendPacket(&packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 6);
|
||||
packet.WriteBit(1); // has queue info
|
||||
packet.WriteBit(0); // unk queue bool
|
||||
packet.WriteBit(0); // has account info
|
||||
packet << uint8(AUTH_WAIT_QUEUE);
|
||||
packet << uint32(position);
|
||||
packet << uint8(0); // unk
|
||||
SendPacket(&packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ class WorldSession
|
||||
void SendSetPhaseShift(uint32 phaseShift);
|
||||
void SendQueryTimeResponse();
|
||||
|
||||
void SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos = 0);
|
||||
void SendAuthResponse(uint8 code, bool queued, uint32 queuePos = 0);
|
||||
void SendClientCacheVersion(uint32 version);
|
||||
|
||||
AccountTypes GetSecurity() const { return _security; }
|
||||
|
||||
@@ -785,16 +785,16 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
||||
int WorldSocket::HandleSendAuthSession()
|
||||
{
|
||||
WorldPacket packet(SMSG_AUTH_CHALLENGE, 37);
|
||||
packet << uint32(0);
|
||||
packet << uint32(0);
|
||||
packet << uint32(0);
|
||||
packet << uint32(0);
|
||||
BigNumber seed1;
|
||||
seed1.SetRand(16 * 8);
|
||||
packet.append(seed1.AsByteArray(16), 16); // new encryption seeds
|
||||
|
||||
BigNumber seed2;
|
||||
seed2.SetRand(16 * 8);
|
||||
packet.append(seed2.AsByteArray(16), 16); // new encryption seeds
|
||||
|
||||
packet << m_Seed;
|
||||
packet << uint8(1);
|
||||
packet << uint32(0);
|
||||
packet << uint32(0);
|
||||
packet << uint32(0);
|
||||
packet << uint32(0);
|
||||
return SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -804,47 +804,58 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
uint32 clientSeed;
|
||||
uint16 clientBuild, security;
|
||||
uint32 id;
|
||||
uint32 m_addonSize;
|
||||
uint32 addonSize;
|
||||
LocaleConstant locale;
|
||||
std::string account;
|
||||
SHA1Hash sha;
|
||||
BigNumber v, s, g, N, k;
|
||||
WorldPacket packet;
|
||||
WorldPacket addonsData;
|
||||
|
||||
recvPacket.read_skip<uint8>();
|
||||
recvPacket.read(digest, 5);
|
||||
recvPacket >> clientBuild;
|
||||
recvPacket.read(digest, 2);
|
||||
recvPacket.read_skip<uint8>();
|
||||
recvPacket.read_skip<uint32>();
|
||||
recvPacket.read(digest, 4);
|
||||
recvPacket.read_skip<uint32>();
|
||||
recvPacket.read_skip<uint8>();
|
||||
recvPacket >> digest[10];
|
||||
recvPacket >> digest[18];
|
||||
recvPacket >> digest[12];
|
||||
recvPacket >> digest[5];
|
||||
recvPacket.read_skip<uint64>();
|
||||
recvPacket >> digest[15];
|
||||
recvPacket >> digest[9];
|
||||
recvPacket >> digest[19];
|
||||
recvPacket >> digest[4];
|
||||
recvPacket >> digest[7];
|
||||
recvPacket >> digest[16];
|
||||
recvPacket >> digest[3];
|
||||
recvPacket >> clientBuild;
|
||||
recvPacket >> digest[8];
|
||||
recvPacket.read_skip<uint32>();
|
||||
recvPacket.read_skip<uint8>();
|
||||
recvPacket.read(digest, 2);
|
||||
recvPacket.read_skip<uint32>();
|
||||
recvPacket.read(digest, 4);
|
||||
recvPacket >> digest[17];
|
||||
recvPacket >> digest[6];
|
||||
recvPacket >> digest[0];
|
||||
recvPacket >> digest[1];
|
||||
recvPacket >> digest[11];
|
||||
recvPacket >> clientSeed;
|
||||
recvPacket.read(digest, 2);
|
||||
recvPacket >> digest[2];
|
||||
recvPacket.read_skip<uint32>();
|
||||
recvPacket.read(digest, 1);
|
||||
recvPacket.read_skip<uint32>();
|
||||
recvPacket >> account;
|
||||
recvPacket >> m_addonSize;
|
||||
recvPacket >> digest[14];
|
||||
recvPacket >> digest[13];
|
||||
|
||||
uint8 * tableauAddon = new uint8[m_addonSize];
|
||||
WorldPacket packetAddon;
|
||||
for (uint32 i = 0; i < m_addonSize; i++)
|
||||
{
|
||||
uint8 ByteSize = 0;
|
||||
recvPacket >> ByteSize;
|
||||
tableauAddon[i] = ByteSize;
|
||||
packetAddon << ByteSize;
|
||||
}
|
||||
delete tableauAddon;
|
||||
recvPacket >> addonSize;
|
||||
addonsData.resize(addonSize);
|
||||
recvPacket.read((uint8*)addonsData.contents(), addonSize);
|
||||
|
||||
uint8 highBitsAccountLen;
|
||||
uint8 lowBitsAccountLen;
|
||||
recvPacket >> highBitsAccountLen;
|
||||
recvPacket >> lowBitsAccountLen;
|
||||
account = recvPacket.ReadString(((highBitsAccountLen << 5) & 0xFF) | (lowBitsAccountLen >> 3));
|
||||
|
||||
if (sWorld->IsClosed())
|
||||
{
|
||||
packet.Initialize(SMSG_AUTH_RESPONSE, 1);
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
|
||||
packet.WriteBit(0); // has queue info
|
||||
packet.WriteBit(0); // has account info
|
||||
packet << uint8(AUTH_REJECT);
|
||||
SendPacket(packet);
|
||||
|
||||
@@ -862,8 +873,10 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
// Stop if the account is not found
|
||||
if (!result)
|
||||
{
|
||||
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
|
||||
packet << uint8 (AUTH_UNKNOWN_ACCOUNT);
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
|
||||
packet.WriteBit(0); // has queue info
|
||||
packet.WriteBit(0); // has account info
|
||||
packet << uint8(AUTH_UNKNOWN_ACCOUNT);
|
||||
|
||||
SendPacket(packet);
|
||||
|
||||
@@ -878,29 +891,31 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
if (expansion > world_expansion)
|
||||
expansion = world_expansion;
|
||||
|
||||
N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
|
||||
g.SetDword (7);
|
||||
N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
|
||||
g.SetDword(7);
|
||||
|
||||
v.SetHexStr(fields[4].GetCString());
|
||||
s.SetHexStr (fields[5].GetCString());
|
||||
s.SetHexStr(fields[5].GetCString());
|
||||
|
||||
const char* sStr = s.AsHexStr(); //Must be freed by OPENSSL_free()
|
||||
const char* vStr = v.AsHexStr(); //Must be freed by OPENSSL_free()
|
||||
|
||||
sLog->outStaticDebug ("WorldSocket::HandleAuthSession: (s,v) check s: %s v: %s",
|
||||
sLog->outStaticDebug("WorldSocket::HandleAuthSession: (s,v) check s: %s v: %s",
|
||||
sStr,
|
||||
vStr);
|
||||
|
||||
OPENSSL_free ((void*) sStr);
|
||||
OPENSSL_free ((void*) vStr);
|
||||
OPENSSL_free((void*) sStr);
|
||||
OPENSSL_free((void*) vStr);
|
||||
|
||||
///- Re-check ip locking (same check as in realmd).
|
||||
if (fields[3].GetUInt8() == 1) // if ip is locked
|
||||
{
|
||||
if (strcmp (fields[2].GetCString(), GetRemoteAddress().c_str()))
|
||||
{
|
||||
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
|
||||
packet << uint8 (AUTH_FAILED);
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
|
||||
packet.WriteBit(0); // has queue info
|
||||
packet.WriteBit(0); // has account info
|
||||
packet << uint8(AUTH_FAILED);
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
|
||||
@@ -914,7 +929,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
security = SEC_ADMINISTRATOR;
|
||||
*/
|
||||
|
||||
k.SetHexStr (fields[1].GetCString());
|
||||
k.SetHexStr(fields[1].GetCString());
|
||||
|
||||
int64 mutetime = fields[7].GetInt64();
|
||||
//! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now.
|
||||
@@ -963,8 +978,10 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
|
||||
if (banresult) // if account banned
|
||||
{
|
||||
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
|
||||
packet << uint8 (AUTH_BANNED);
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
|
||||
packet.WriteBit(0); // has queue info
|
||||
packet.WriteBit(0); // has account info
|
||||
packet << uint8(AUTH_BANNED);
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
|
||||
@@ -976,8 +993,10 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security));
|
||||
if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType)
|
||||
{
|
||||
WorldPacket Packet (SMSG_AUTH_RESPONSE, 1);
|
||||
Packet << uint8 (AUTH_UNAVAILABLE);
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
|
||||
packet.WriteBit(0); // has queue info
|
||||
packet.WriteBit(0); // has account info
|
||||
packet << uint8(AUTH_UNAVAILABLE);
|
||||
|
||||
SendPacket(packet);
|
||||
|
||||
@@ -989,16 +1008,27 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
uint32 t = 0;
|
||||
uint32 seed = m_Seed;
|
||||
|
||||
sha.UpdateData (account);
|
||||
sha.UpdateData ((uint8 *) & t, 4);
|
||||
sha.UpdateData ((uint8 *) & clientSeed, 4);
|
||||
sha.UpdateData ((uint8 *) & seed, 4);
|
||||
sha.UpdateBigNumbers (&k, NULL);
|
||||
sha.UpdateData(account);
|
||||
sha.UpdateData((uint8*)&t, 4);
|
||||
sha.UpdateData((uint8*)&clientSeed, 4);
|
||||
sha.UpdateData((uint8*)&seed, 4);
|
||||
sha.UpdateBigNumbers(&k, NULL);
|
||||
sha.Finalize();
|
||||
|
||||
std::string address = GetRemoteAddress();
|
||||
|
||||
sLog->outStaticDebug ("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
|
||||
if (memcmp(sha.GetDigest(), digest, 20))
|
||||
{
|
||||
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
|
||||
packet << uint8(AUTH_FAILED);
|
||||
|
||||
SendPacket(packet);
|
||||
|
||||
sLog->outError("WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
sLog->outStaticDebug("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
|
||||
account.c_str(),
|
||||
address.c_str());
|
||||
|
||||
@@ -1023,14 +1053,13 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
// NOTE ATM the socket is single-threaded, have this in mind ...
|
||||
ACE_NEW_RETURN (m_Session, WorldSession (id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter), -1);
|
||||
ACE_NEW_RETURN(m_Session, WorldSession(id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter), -1);
|
||||
|
||||
m_Crypt.Init(&k);
|
||||
|
||||
m_Session->LoadGlobalAccountData();
|
||||
m_Session->LoadTutorialsData();
|
||||
packetAddon.rpos(0);
|
||||
m_Session->ReadAddonsInfo(packetAddon);
|
||||
m_Session->ReadAddonsInfo(addonsData);
|
||||
|
||||
// Initialize Warden system only if it is enabled by config
|
||||
if (sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
|
||||
@@ -1038,10 +1067,9 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
|
||||
// Sleep this Network thread for
|
||||
uint32 sleepTime = sWorld->getIntConfig(CONFIG_SESSION_ADD_DELAY);
|
||||
ACE_OS::sleep (ACE_Time_Value (0, sleepTime));
|
||||
|
||||
sWorld->AddSession (m_Session);
|
||||
ACE_OS::sleep(ACE_Time_Value (0, sleepTime));
|
||||
|
||||
sWorld->AddSession(m_Session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ void World::AddSession_(WorldSession* s)
|
||||
return;
|
||||
}
|
||||
|
||||
s->SendAuthResponse(AUTH_OK, true);
|
||||
s->SendAuthResponse(AUTH_OK, false);
|
||||
s->SendAddonsInfo();
|
||||
s->SendClientCacheVersion(sWorld->getIntConfig(CONFIG_CLIENTCACHE_VERSION));
|
||||
s->SendTutorialsData();
|
||||
@@ -328,7 +328,7 @@ void World::AddQueuedPlayer(WorldSession* sess)
|
||||
m_QueuedPlayer.push_back(sess);
|
||||
|
||||
// The 1st SMSG_AUTH_RESPONSE needs to contain other info too.
|
||||
sess->SendAuthResponse(AUTH_WAIT_QUEUE, false, GetQueuePos(sess));
|
||||
sess->SendAuthResponse(AUTH_WAIT_QUEUE, true, GetQueuePos(sess));
|
||||
}
|
||||
|
||||
bool World::RemoveQueuedPlayer(WorldSession* sess)
|
||||
|
||||
@@ -564,11 +564,21 @@ class ByteBuffer
|
||||
|
||||
std::string ReadString()
|
||||
{
|
||||
std::string s = 0;
|
||||
std::string s;
|
||||
(*this) >> s;
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string ReadString(uint32 length)
|
||||
{
|
||||
char* buffer = new char[length + 1];
|
||||
memset(buffer, 0, length + 1);
|
||||
read((uint8*)buffer, length);
|
||||
std::string retval = buffer;
|
||||
delete[] buffer;
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool ReadBoolean()
|
||||
{
|
||||
uint8 b = 0;
|
||||
|
||||
Reference in New Issue
Block a user