Пример #1
0
        /// <summary>
        /// Handles SecurityViolationException.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="ex"></param>
        private void HandleSecurityException(ChannelClient client, SecurityViolationException ex)
        {
            var accName  = client.Account == null ? "<NULL>" : "'" + client.Account.Id + "'";
            var charName = client.Controlling == null ? "<NULL>" : "'" + client.Controlling.Name + "'";

            if (client.Account != null)
            {
                ChannelServer.Instance.Database.LogSecurityIncident(client, ex.Level, ex.Message, ex.StackReport);
            }

            ChannelServer.Instance.Events.OnSecurityViolation(new SecurityViolationEventArgs(client, ex.Level, ex.Message, ex.StackReport));

            client.Kill();

            Log.Warning("Client '{0}' : Account {1} (Controlling {2}) just committed a {3} offense. Incident report: {4}", client.Address, accName, charName, ex.Level, ex.Message);
        }
Пример #2
0
        /// <summary>
        /// Handles SecurityViolationException.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="ex"></param>
        private void HandleSecurityException(ChannelClient client, SecurityViolationException ex)
        {
            var accName  = client.Account == null ? "<NULL>" : "'" + client.Account.Id + "'";
            var charName = client.Controlling == null ? "<NULL>" : "'" + client.Controlling.Name + "'";

            if (client.Account != null)
            {
                ChannelServer.Instance.Database.LogSecurityIncident(client, ex.Level, ex.Message, ex.StackReport);
            }

            ChannelServer.Instance.Events.OnSecurityViolation(new SecurityViolationEventArgs(client, ex.Level, ex.Message, ex.StackReport));

            // Don't kill connection, since this frequently happens when the
            // client sends a packet for a creature it doesn't control anymore.
            //client.Kill();

            Log.Debug("Client '{0}' : Account {1} (Controlling {2}) just committed a {3} offense. Incident report: {4}", client.Address, accName, charName, ex.Level, ex.Message);
        }