Beispiel #1
0
        /// <summary>
        /// Handle a player challenge response
        /// </summary>
        /// <param name="serverInfo"></param>
        protected virtual void HandleClientChallengeResponse(ServerInfoPacket serverInfo)
        {
            MasterServer.Log("[{0}] Received STM_ClientResponse", server);

            if (serverInfo.ProcessClientResponse())
            {
                ConnectionLog("STM_CLIENTRESPONSE MD5={0} MD5={1}", serverInfo.ClientCDKey, serverInfo.ClientCDKeySalted);

                MasterServer.Log("{0} MD5={1}", serverInfo.ClientIP, serverInfo.ClientCDKey);
                MasterServer.Log("{0} MD5={1}", serverInfo.ClientIP, serverInfo.ClientCDKeySalted);

                if (validationContexts.ContainsKey(serverInfo.ClientIP))
                {
                    ValidationContext clientValidationContext = validationContexts[serverInfo.ClientIP];
                    validationContexts.Remove(serverInfo.ClientIP);

                    clientValidationContext.SetClientInfo(serverInfo.ClientCDKey, serverInfo.ClientCDKeySalted, outerConnection.Type, outerConnection.Version);

                    // Check player CD key is valid?
                    if (!cdKeyValidator.ValidateKey(clientValidationContext))
                    {
                        MasterServer.Log("Client {0} CD key invalid. Disconnecting client.", serverInfo.ClientIP);
                        DisconnectClient(serverInfo.ClientIP);
                    }
                    else if (!cdKeyValidator.ValidateSaltedKey(clientValidationContext))
                    {
                        MasterServer.Log("Client {0} failed challenge. Disconnecting client.", serverInfo.ClientIP);
                        DisconnectClient(serverInfo.ClientIP);
                    }
                    else
                    {
                        MasterServer.Log("Client {0} challenge succeeded.", serverInfo.ClientIP);
                    }

                    cdKeyValidator.EndValidation(clientValidationContext);
                }
                else
                {
                    MasterServer.Log("Client {0} challenge unverified. No matching context found!");
                }
            }
            else
            {
                ConnectionLog("STM_CLIENTRESPONSE BAD: {0}", serverInfo.Print());
            }
        }
Beispiel #2
0
        /// <summary>
        /// Handle an MD5 version packet
        /// </summary>
        /// <param name="serverInfo"></param>
        protected virtual void HandleMD5Version(ServerInfoPacket serverInfo)
        {
            if (serverInfo.ProcessMD5Version())
            {
                ConnectionLog("STM_MD5VERSION VERSION={0}", serverInfo.MD5Version);
                MasterServer.Log("[{0}] STM_MD5Version with: {1}", server, serverInfo.MD5Version);

                List <MD5Entry> updates = md5Manager.Get(serverInfo.MD5Version);

                if (updates.Count > 0)
                {
                    SendMD5Updates(updates);
                }
            }
            else
            {
                ConnectionLog("STM_MD5VERSION BAD: {0}", serverInfo.Print());
            }
        }
Beispiel #3
0
        /// <summary>
        /// Handle a CheckOption reply packet. Displays the value on screen
        /// </summary>
        /// <param name="serverInfo"></param>
        protected virtual void HandleCheckOptionReply(ServerInfoPacket serverInfo)
        {
            if (serverInfo.ProcessCheckOptionResponse())
            {
                ConnectionLog("STM_CHECKOPTIONREPLY PKG={0} VAR={1} VALUE=\"{2}\"", serverInfo.OptionPackageName, serverInfo.OptionVariableName, serverInfo.OptionVariableValue);

                MasterServer.LogMessage("[{0}] {1} {2}=\"{3}\"", server, serverInfo.OptionPackageName, serverInfo.OptionVariableName, serverInfo.OptionVariableValue);

                CheckOptionReplyEventHandler checkOptionReply = this.CheckOptionReply;

                if (checkOptionReply != null)
                {
                    checkOptionReply(serverInfo.OptionPackageName, serverInfo.OptionVariableName, serverInfo.OptionVariableValue);
                }
            }
            else
            {
                ConnectionLog("STM_CHECKOPTIONREPLY BAD: {0}", serverInfo.Print());
            }
        }
Beispiel #4
0
        /// <summary>
        /// Handle a gamestate packet from a server
        /// </summary>
        /// <param name="serverInfo"></param>
        protected virtual void HandleGameState(ServerInfoPacket serverInfo)
        {
            // MasterServer.Log("[{0}] STM_GameState", server);
            if (serverInfo.ProcessGameState(server, logWriter))
            {
                ConnectionLog("STM_GAMESTATE OK");
                serverList.UpdateServer(server, serverInfo);
                SendMatchID();
            }
            else
            {
                ConnectionLog("STM_GAMESTATE BAD: {0}", serverInfo.Print());
                gameStateParseFailureCount++;
            }

            if (gameStateParseFailureCount > 5)
            {
                MasterServer.Log("[{0}] WARN: Invalid STM_GameState", server);
                gameStateParseFailureCount = 0;
            }
        }