Exemple #1
0
        void HandleRealmLogonProof()
        {
            ServerAuthProof proof = new ServerAuthProof(new BinaryReader(connection.GetStream()));

            switch (proof.error)
            {
                case AuthResult.UPDATE_CLIENT:
                    Game.UI.LogLine("Client update requested");
                    break;
                case AuthResult.NO_MATCH:
                case AuthResult.UNKNOWN2:
                    Game.UI.LogLine("Wrong password or invalid account or authentication error", LogLevel.Error);
                    break;
                case AuthResult.WRONG_BUILD_NUMBER:
                    Game.UI.LogLine("Wrong build number", LogLevel.Error);
                    break;
                default:
                    if (proof.error != AuthResult.SUCCESS)
                        Game.UI.LogLine(string.Format("Unkown error {0}", proof.error), LogLevel.Error);
                    break;
            }

            if (proof.error != AuthResult.SUCCESS)
            {
                SendLogonChallenge();
                return;
            }

            Game.UI.LogLine("Received logon proof", LogLevel.Debug);

            bool equal = true;
            equal = m2 != null && m2.Length == 20;
            for (int i = 0; i < m2.Length && equal; ++i)
                if (!(equal = m2[i] == proof.M2[i]))
                    break;

            if (!equal)
                Game.UI.LogLine("Server auth failed!", LogLevel.Error);
            else
            {
                Game.UI.LogLine("Authentication succeeded!");
                Game.UI.LogLine("Requesting realm list", LogLevel.Detail);
                output.Write((byte)AuthCommand.REALM_LIST);
                output.Write((uint)0);
            }

            // get next command
            ReadCommand();
        }
Exemple #2
0
        void HandleRealmLogonProof()
        {
            ServerAuthProof proof = new ServerAuthProof(new BinaryReader(connection.GetStream()));

            switch (proof.error)
            {
            case AuthResult.UPDATE_CLIENT:
                Game.UI.LogLine("Client update requested");
                break;

            case AuthResult.NO_MATCH:
            case AuthResult.UNKNOWN2:
                Game.UI.LogLine("Wrong password or invalid account or authentication error", LogLevel.Error);
                failedAuthentications++;
                if (failedAuthentications >= MAX_FAILED_AUTENTICATIONS)
                {
                    Game.InvalidCredentials();
                    return;
                }
                Thread.Sleep(1000);
                break;

            case AuthResult.WRONG_BUILD_NUMBER:
                Game.UI.LogLine("Wrong build number", LogLevel.Error);
                break;

            default:
                if (proof.error != AuthResult.SUCCESS)
                {
                    Game.UI.LogLine(string.Format("Unkown error {0}", proof.error), LogLevel.Error);
                }
                break;
            }

            if (proof.error != AuthResult.SUCCESS)
            {
                SendLogonChallenge();
                return;
            }

            Game.UI.LogDebug("Received logon proof");

            bool equal = true;

            equal = m2 != null && m2.Length == 20;
            for (int i = 0; i < m2.Length && equal; ++i)
            {
                if (!(equal = m2[i] == proof.M2[i]))
                {
                    break;
                }
            }

            if (!equal)
            {
                Game.UI.LogDebug("Server auth failed!");
                SendLogonChallenge();
                return;
            }
            else
            {
                Game.UI.LogLine("Authentication succeeded!");
                failedAuthentications = 0;
                Game.UI.LogLine("Requesting realm list", LogLevel.Detail);
                var buffer = new byte[] { (byte)AuthCommand.REALM_LIST, 0x0, 0x0, 0x0, 0x0 };
                stream.Write(buffer, 0, buffer.Length);
            }

            // get next command
            ReadCommand();
        }
Exemple #3
0
        void HandleRealmLogonProof()
        {
            ServerAuthProof proof = new ServerAuthProof(new BinaryReader(connection.GetStream()));

            switch (proof.error)
            {
                case AuthResult.UPDATE_CLIENT:
                    Game.UI.LogLine("Client update requested");
                    break;
                case AuthResult.NO_MATCH:
                case AuthResult.UNKNOWN2:
                    Game.UI.LogLine("Wrong password or invalid account or authentication error", LogLevel.Error);
                    failedAuthentications++;
                    if (failedAuthentications >= MAX_FAILED_AUTENTICATIONS)
                    {
                        Game.InvalidCredentials();
                        return;
                    }
                    Thread.Sleep(1000);
                    break;
                case AuthResult.WRONG_BUILD_NUMBER:
                    Game.UI.LogLine("Wrong build number", LogLevel.Error);
                    break;
                default:
                    if (proof.error != AuthResult.SUCCESS)
                        Game.UI.LogLine(string.Format("Unkown error {0}", proof.error), LogLevel.Error);
                    break;
            }

            if (proof.error != AuthResult.SUCCESS)
            {
                SendLogonChallenge();
                return;
            }

            Game.UI.LogDebug("Received logon proof");

            bool equal = true;
            equal = m2 != null && m2.Length == 20;
            for (int i = 0; i < m2.Length && equal; ++i)
                if (!(equal = m2[i] == proof.M2[i]))
                    break;

            if (!equal)
            {
                Game.UI.LogDebug("Server auth failed!");
                SendLogonChallenge();
                return;
            }
            else
            {
                Game.UI.LogLine("Authentication succeeded!");
                failedAuthentications = 0;
                Game.UI.LogLine("Requesting realm list", LogLevel.Detail);
                var buffer = new byte[] { (byte)AuthCommand.REALM_LIST, 0x0, 0x0, 0x0, 0x0 };
                stream.Write(buffer, 0, buffer.Length);
            }

            // get next command
            ReadCommand();
        }