diff --git a/src/glue/CGlueMgr.cpp b/src/glue/CGlueMgr.cpp index 656bc3f..6c08d79 100644 --- a/src/glue/CGlueMgr.cpp +++ b/src/glue/CGlueMgr.cpp @@ -486,9 +486,9 @@ void CGlueMgr::PollLoginServerLogin() { } case LOGIN_STATE_CHECKINGVERSIONS: { - uint8_t versionChecksum[VERSION_CHECKSUM_LEN]; + uint8_t versionChecksum[LOGIN_VERSION_CHECKSUM_LEN]; auto versionChallenge = ClientServices::LoginConnection()->GetVersionChallenge(); - ChecksumExecutables(versionChallenge, VERSION_CHALLENGE_LEN, versionChecksum); + ChecksumExecutables(versionChallenge, LOGIN_VERSION_CHALLENGE_LEN, versionChecksum); ClientServices::LoginConnection()->ProveVersion(versionChecksum); diff --git a/src/glue/CGlueMgr.hpp b/src/glue/CGlueMgr.hpp index aceba1e..77ebb0b 100644 --- a/src/glue/CGlueMgr.hpp +++ b/src/glue/CGlueMgr.hpp @@ -2,8 +2,8 @@ #define GLUE_C_GLUE_MGR_HPP #include "event/Event.hpp" +#include "net/Login.hpp" #include "net/Types.hpp" -#include class CDataStore; class CSimpleTop; diff --git a/src/net/Login.hpp b/src/net/Login.hpp index 844b2ce..fc07fb2 100644 --- a/src/net/Login.hpp +++ b/src/net/Login.hpp @@ -3,5 +3,6 @@ #include "net/login/BattlenetLogin.hpp" #include "net/login/GruntLogin.hpp" +#include "net/login/Types.hpp" #endif diff --git a/src/net/Types.hpp b/src/net/Types.hpp index 809361e..a5957b3 100644 --- a/src/net/Types.hpp +++ b/src/net/Types.hpp @@ -3,76 +3,6 @@ #include -#define VERSION_CHALLENGE_LEN 16 -#define VERSION_CHECKSUM_LEN 20 - -enum LOGIN_RESULT { - LOGIN_OK = 0, - LOGIN_INVALID_CHALLENGE_MESSAGE = 1, - LOGIN_SRP_ERROR = 2, - LOGIN_INVALID_PROOF_MESSAGE = 3, - LOGIN_BAD_SERVER_PROOF = 4, - LOGIN_INVALID_RECODE_MESSAGE = 5, - LOGIN_BAD_SERVER_RECODE_PROOF = 6, - LOGIN_UNKNOWN_ACCOUNT = 7, - LOGIN_UNKNOWN_ACCOUNT_PIN = 8, - LOGIN_UNKNOWN_ACCOUNT_CALL = 9, - LOGIN_INCORRECT_PASSWORD = 10, - LOGIN_FAILED = 11, - LOGIN_SERVER_DOWN = 12, - LOGIN_BANNED = 13, - LOGIN_BADVERSION = 14, - LOGIN_ALREADYONLINE = 15, - LOGIN_NOTIME = 16, - LOGIN_DBBUSY = 17, - LOGIN_SUSPENDED = 18, - LOGIN_PARENTALCONTROL = 19, - LOGIN_LOCKED_ENFORCED = 20, - LOGIN_RESULT_21 = 21, // DISCONNECTED - LOGIN_ACCOUNT_CONVERTED = 22, - LOGIN_ANTI_INDULGENCE = 23, - LOGIN_EXPIRED = 24, - LOGIN_TRIAL_EXPIRED = 25, - LOGIN_NO_GAME_ACCOUNT = 26, - LOGIN_AUTH_OUTAGE = 27, - LOGIN_GAME_ACCOUNT_LOCKED = 28, - LOGIN_NO_BATTLENET_MANAGER = 29, - LOGIN_NO_BATTLENET_APPLICATION = 30, - LOGIN_MALFORMED_ACCOUNT_NAME = 31, - LOGIN_USE_GRUNT = 32, - LOGIN_TOO_FAST = 33, - LOGIN_CHARGEBACK = 34, - LOGIN_IGR_WITHOUT_BNET = 35, - LOGIN_UNLOCKABLE_LOCK = 36, - LOGIN_CONVERSION_REQUIRED = 37, - LOGIN_UNABLE_TO_DOWNLOAD_MODULE = 38, - LOGIN_NO_GAME_ACCOUNTS_IN_REGION = 39, - LOGIN_ACCOUNT_LOCKED = 40, - LOGIN_RESULT_MAX = 41, -}; - -enum LOGIN_STATE { - LOGIN_STATE_INITIALIZED = 0, - LOGIN_STATE_CONNECTING = 1, - LOGIN_STATE_HANDSHAKING = 2, - LOGIN_STATE_AUTHENTICATING = 3, - LOGIN_STATE_AUTHENTICATED = 4, - LOGIN_STATE_FAILED = 5, - LOGIN_STATE_DOWNLOADFILE = 6, - LOGIN_STATE_FIRST_SECURITY = 7, - LOGIN_STATE_PIN = 8, - LOGIN_STATE_PIN_WAIT = 9, - LOGIN_STATE_MATRIX = 10, - LOGIN_STATE_MATRIX_WAIT = 11, - LOGIN_STATE_TOKEN = 12, - LOGIN_STATE_TOKEN_WAIT = 13, - LOGIN_STATE_CHECKINGVERSIONS = 14, - LOGIN_STATE_15 = 15, // RESPONSE_CONNECTED - LOGIN_STATE_DISCONNECTED = 16, - LOGIN_STATE_SURVEY = 17, - LOGIN_STATE_MAX = 18, -}; - enum NETMESSAGE { MSG_NULL_ACTION = 0x0000, CMSG_BOOTME = 0x0001, diff --git a/src/net/grunt/ClientLink.cpp b/src/net/grunt/ClientLink.cpp index 8944dc1..6fb03f7 100644 --- a/src/net/grunt/ClientLink.cpp +++ b/src/net/grunt/ClientLink.cpp @@ -2,6 +2,7 @@ #include "net/connection/WowConnection.hpp" #include "net/grunt/ClientResponse.hpp" #include "net/grunt/Command.hpp" +#include "net/login/Types.hpp" #include "net/srp/SRP6_Random.hpp" #include #include @@ -114,13 +115,13 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) { uint8_t* salt; uint8_t* versionChallenge; - if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + VERSION_CHALLENGE_LEN)) { + if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + LOGIN_VERSION_CHALLENGE_LEN)) { return 0; } msg.GetDataInSitu(reinterpret_cast(largeSafePrime), largeSafePrimeLen); msg.GetDataInSitu(reinterpret_cast(salt), SALT_LEN); - msg.GetDataInSitu(reinterpret_cast(versionChallenge), VERSION_CHALLENGE_LEN); + msg.GetDataInSitu(reinterpret_cast(versionChallenge), LOGIN_VERSION_CHALLENGE_LEN); uint8_t logonFlags; @@ -353,7 +354,7 @@ int32_t Grunt::ClientLink::CmdAuthReconnectChallenge(CDataStore& msg) { // Reconnect challenge success (result == 0) msg.GetDataInSitu(reinterpret_cast(reconnectKey), RECONNECT_KEY_LEN); - msg.GetDataInSitu(reinterpret_cast(versionChallenge), VERSION_CHALLENGE_LEN); + msg.GetDataInSitu(reinterpret_cast(versionChallenge), LOGIN_VERSION_CHALLENGE_LEN); if (!msg.IsValid()) { return 1; @@ -645,7 +646,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) { SHA1_Init(&sha1); SHA1_Update(&sha1, this->m_srpClient.clientPublicKey, sizeof(this->m_srpClient.clientPublicKey)); - SHA1_Update(&sha1, versionChecksum, VERSION_CHECKSUM_LEN); + SHA1_Update(&sha1, versionChecksum, LOGIN_VERSION_CHECKSUM_LEN); SHA1_Final(clientVersionProof, &sha1); command.PutData(clientVersionProof, sizeof(clientVersionProof)); @@ -695,7 +696,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) { SHA1_Init(&sha1); SHA1_Update(&sha1, clientSalt, sizeof(clientSalt)); - SHA1_Update(&sha1, versionChecksum, VERSION_CHECKSUM_LEN); + SHA1_Update(&sha1, versionChecksum, LOGIN_VERSION_CHECKSUM_LEN); SHA1_Final(clientVersionProof, &sha1); command.PutData(clientVersionProof, sizeof(clientVersionProof)); diff --git a/src/net/grunt/ClientResponse.hpp b/src/net/grunt/ClientResponse.hpp index 3ccd6e2..6861a69 100644 --- a/src/net/grunt/ClientResponse.hpp +++ b/src/net/grunt/ClientResponse.hpp @@ -2,10 +2,12 @@ #define NET_GRUNT_CLIENT_RESPONSE_HPP #include "net/grunt/Grunt.hpp" -#include "net/Types.hpp" +#include "net/login/Types.hpp" +#include class CDataStore; class LoginResponse; +struct NETADDR; class Grunt::ClientResponse { public: diff --git a/src/net/login/GruntLogin.cpp b/src/net/login/GruntLogin.cpp index 71b93cb..535e983 100644 --- a/src/net/login/GruntLogin.cpp +++ b/src/net/login/GruntLogin.cpp @@ -96,7 +96,7 @@ const uint8_t* GruntLogin::GetVersionChallenge() { void GruntLogin::GetVersionProof(const uint8_t* versionChallenge) { if (this->IsReconnect()) { // During reconnect, version challenge is ignored and version checksum is zeroed out - uint8_t versionChecksum[VERSION_CHECKSUM_LEN] = {}; + uint8_t versionChecksum[LOGIN_VERSION_CHECKSUM_LEN] = {}; this->m_clientLink->ProveVersion(versionChecksum); } else { diff --git a/src/net/login/GruntLogin.hpp b/src/net/login/GruntLogin.hpp index a7fc43f..1b14754 100644 --- a/src/net/login/GruntLogin.hpp +++ b/src/net/login/GruntLogin.hpp @@ -4,12 +4,12 @@ #include "net/grunt/ClientResponse.hpp" #include "net/grunt/Grunt.hpp" #include "net/login/Login.hpp" -#include "net/Types.hpp" +#include "net/login/Types.hpp" class GruntLogin : public Login { public: // Member variables - uint8_t m_versionChallenge[VERSION_CHALLENGE_LEN]; + uint8_t m_versionChallenge[LOGIN_VERSION_CHALLENGE_LEN]; Grunt::ClientLink* m_clientLink = nullptr; // Virtual member functions diff --git a/src/net/login/LoginResponse.hpp b/src/net/login/LoginResponse.hpp index ea2417e..284723c 100644 --- a/src/net/login/LoginResponse.hpp +++ b/src/net/login/LoginResponse.hpp @@ -1,6 +1,7 @@ #ifndef NET_LOGIN_LOGIN_RESPONSE_HPP #define NET_LOGIN_LOGIN_RESPONSE_HPP +#include "net/login/Types.hpp" #include "net/Types.hpp" #include diff --git a/src/net/login/Types.hpp b/src/net/login/Types.hpp new file mode 100644 index 0000000..eed7a0f --- /dev/null +++ b/src/net/login/Types.hpp @@ -0,0 +1,74 @@ +#ifndef NET_LOGIN_TYPES_HPP +#define NET_LOGIN_TYPES_HPP + +#define LOGIN_VERSION_CHALLENGE_LEN 16 +#define LOGIN_VERSION_CHECKSUM_LEN 20 + +enum LOGIN_RESULT { + LOGIN_OK = 0, + LOGIN_INVALID_CHALLENGE_MESSAGE = 1, + LOGIN_SRP_ERROR = 2, + LOGIN_INVALID_PROOF_MESSAGE = 3, + LOGIN_BAD_SERVER_PROOF = 4, + LOGIN_INVALID_RECODE_MESSAGE = 5, + LOGIN_BAD_SERVER_RECODE_PROOF = 6, + LOGIN_UNKNOWN_ACCOUNT = 7, + LOGIN_UNKNOWN_ACCOUNT_PIN = 8, + LOGIN_UNKNOWN_ACCOUNT_CALL = 9, + LOGIN_INCORRECT_PASSWORD = 10, + LOGIN_FAILED = 11, + LOGIN_SERVER_DOWN = 12, + LOGIN_BANNED = 13, + LOGIN_BADVERSION = 14, + LOGIN_ALREADYONLINE = 15, + LOGIN_NOTIME = 16, + LOGIN_DBBUSY = 17, + LOGIN_SUSPENDED = 18, + LOGIN_PARENTALCONTROL = 19, + LOGIN_LOCKED_ENFORCED = 20, + LOGIN_RESULT_21 = 21, // DISCONNECTED + LOGIN_ACCOUNT_CONVERTED = 22, + LOGIN_ANTI_INDULGENCE = 23, + LOGIN_EXPIRED = 24, + LOGIN_TRIAL_EXPIRED = 25, + LOGIN_NO_GAME_ACCOUNT = 26, + LOGIN_AUTH_OUTAGE = 27, + LOGIN_GAME_ACCOUNT_LOCKED = 28, + LOGIN_NO_BATTLENET_MANAGER = 29, + LOGIN_NO_BATTLENET_APPLICATION = 30, + LOGIN_MALFORMED_ACCOUNT_NAME = 31, + LOGIN_USE_GRUNT = 32, + LOGIN_TOO_FAST = 33, + LOGIN_CHARGEBACK = 34, + LOGIN_IGR_WITHOUT_BNET = 35, + LOGIN_UNLOCKABLE_LOCK = 36, + LOGIN_CONVERSION_REQUIRED = 37, + LOGIN_UNABLE_TO_DOWNLOAD_MODULE = 38, + LOGIN_NO_GAME_ACCOUNTS_IN_REGION = 39, + LOGIN_ACCOUNT_LOCKED = 40, + LOGIN_RESULT_MAX = 41, +}; + +enum LOGIN_STATE { + LOGIN_STATE_INITIALIZED = 0, + LOGIN_STATE_CONNECTING = 1, + LOGIN_STATE_HANDSHAKING = 2, + LOGIN_STATE_AUTHENTICATING = 3, + LOGIN_STATE_AUTHENTICATED = 4, + LOGIN_STATE_FAILED = 5, + LOGIN_STATE_DOWNLOADFILE = 6, + LOGIN_STATE_FIRST_SECURITY = 7, + LOGIN_STATE_PIN = 8, + LOGIN_STATE_PIN_WAIT = 9, + LOGIN_STATE_MATRIX = 10, + LOGIN_STATE_MATRIX_WAIT = 11, + LOGIN_STATE_TOKEN = 12, + LOGIN_STATE_TOKEN_WAIT = 13, + LOGIN_STATE_CHECKINGVERSIONS = 14, + LOGIN_STATE_15 = 15, // RESPONSE_CONNECTED + LOGIN_STATE_DISCONNECTED = 16, + LOGIN_STATE_SURVEY = 17, + LOGIN_STATE_MAX = 18, +}; + +#endif