mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Use legacy LOGON_PROOF format for auth protocol < 8
This commit is contained in:
parent
dca8fcad31
commit
280c6ffa1d
6 changed files with 36 additions and 11 deletions
|
|
@ -4,7 +4,7 @@
|
|||
"shortName": "Classic",
|
||||
"version": { "major": 1, "minor": 12, "patch": 1 },
|
||||
"build": 5875,
|
||||
"protocolVersion": 8,
|
||||
"protocolVersion": 3,
|
||||
"maxLevel": 60,
|
||||
"races": [1, 2, 3, 4, 5, 6, 7, 8],
|
||||
"classes": [1, 2, 3, 4, 5, 7, 8, 9, 11]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"shortName": "TBC",
|
||||
"version": { "major": 2, "minor": 4, "patch": 3 },
|
||||
"build": 8606,
|
||||
"protocolVersion": 8,
|
||||
"protocolVersion": 5,
|
||||
"maxLevel": 70,
|
||||
"races": [1, 2, 3, 4, 5, 6, 7, 8, 10, 11],
|
||||
"classes": [1, 2, 3, 4, 5, 6, 7, 8, 9, 11]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"shortName": "Turtle",
|
||||
"version": { "major": 1, "minor": 12, "patch": 1 },
|
||||
"build": 5875,
|
||||
"protocolVersion": 8,
|
||||
"protocolVersion": 3,
|
||||
"locale": "enGB",
|
||||
"maxLevel": 60,
|
||||
"races": [1, 2, 3, 4, 5, 6, 7, 8],
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ class LogonProofPacket {
|
|||
public:
|
||||
static network::Packet build(const std::vector<uint8_t>& A,
|
||||
const std::vector<uint8_t>& M1);
|
||||
// Legacy (protocol < 8): A(32) + M1(20) + crc(20) + number_of_keys(1). No securityFlags byte.
|
||||
static network::Packet buildLegacy(const std::vector<uint8_t>& A,
|
||||
const std::vector<uint8_t>& M1);
|
||||
static network::Packet build(const std::vector<uint8_t>& A,
|
||||
const std::vector<uint8_t>& M1,
|
||||
uint8_t securityFlags,
|
||||
|
|
|
|||
|
|
@ -236,16 +236,21 @@ void AuthHandler::sendLogonProof() {
|
|||
}
|
||||
}
|
||||
|
||||
// Protocol < 8 uses a shorter proof packet (no securityFlags byte).
|
||||
if (clientInfo.protocolVersion < 8) {
|
||||
auto packet = LogonProofPacket::buildLegacy(A, M1);
|
||||
socket->send(packet);
|
||||
} else {
|
||||
auto packet = LogonProofPacket::build(A, M1, securityFlags_, pinClientSaltPtr, pinHashPtr);
|
||||
socket->send(packet);
|
||||
|
||||
if (securityFlags_ & 0x04) {
|
||||
// TrinityCore-style Google Authenticator token: send immediately after proof.
|
||||
// Token is typically 6 digits.
|
||||
const std::string token = pendingSecurityCode_;
|
||||
auto tokPkt = AuthenticatorTokenPacket::build(token);
|
||||
socket->send(tokPkt);
|
||||
}
|
||||
}
|
||||
|
||||
setState(AuthState::PROOF_SENT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,6 +165,23 @@ network::Packet LogonProofPacket::build(const std::vector<uint8_t>& A,
|
|||
return build(A, M1, 0, nullptr, nullptr);
|
||||
}
|
||||
|
||||
network::Packet LogonProofPacket::buildLegacy(const std::vector<uint8_t>& A,
|
||||
const std::vector<uint8_t>& M1) {
|
||||
if (A.size() != 32) {
|
||||
LOG_ERROR("Invalid A size: ", A.size(), " (expected 32)");
|
||||
}
|
||||
if (M1.size() != 20) {
|
||||
LOG_ERROR("Invalid M1 size: ", M1.size(), " (expected 20)");
|
||||
}
|
||||
|
||||
network::Packet packet(static_cast<uint16_t>(AuthOpcode::LOGON_PROOF));
|
||||
packet.writeBytes(A.data(), A.size());
|
||||
packet.writeBytes(M1.data(), M1.size());
|
||||
for (int i = 0; i < 20; ++i) packet.writeUInt8(0); // CRC hash
|
||||
packet.writeUInt8(0); // number of keys
|
||||
return packet;
|
||||
}
|
||||
|
||||
network::Packet LogonProofPacket::build(const std::vector<uint8_t>& A,
|
||||
const std::vector<uint8_t>& M1,
|
||||
uint8_t securityFlags,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue