aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2011-05-14 17:24:59 +0200
committerMelanie2011-05-14 17:24:59 +0200
commit344815ab79b38bf0f761fc2b001d745811aa0088 (patch)
tree1b17240a722f2e0ce23887ed5ad9966d76c3769e /OpenSim
parentPlug a hole that allows selling a copy of no copy objects when using hacked g... (diff)
downloadopensim-SC-344815ab79b38bf0f761fc2b001d745811aa0088.zip
opensim-SC-344815ab79b38bf0f761fc2b001d745811aa0088.tar.gz
opensim-SC-344815ab79b38bf0f761fc2b001d745811aa0088.tar.bz2
opensim-SC-344815ab79b38bf0f761fc2b001d745811aa0088.tar.xz
Globally throttle script channel 0 comms to 5/s with 10s burst to prevent lag
griefing attacks
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 62eb7f7..1f60a7b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -33,6 +33,7 @@ using System.Runtime.Remoting.Lifetime;
33using System.Text; 33using System.Text;
34using System.Threading; 34using System.Threading;
35using System.Text.RegularExpressions; 35using System.Text.RegularExpressions;
36using System.Timers;
36using Nini.Config; 37using Nini.Config;
37using log4net; 38using log4net;
38using OpenMetaverse; 39using OpenMetaverse;
@@ -66,6 +67,7 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
66using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 67using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
67using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 68using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
68using System.Reflection; 69using System.Reflection;
70using Timer = System.Timers.Timer;
69 71
70namespace OpenSim.Region.ScriptEngine.Shared.Api 72namespace OpenSim.Region.ScriptEngine.Shared.Api
71{ 73{
@@ -105,8 +107,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
105 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = 107 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
106 new Dictionary<UUID, UserInfoCacheEntry>(); 108 new Dictionary<UUID, UserInfoCacheEntry>();
107 109
110 protected Timer m_ShoutSayTimer;
111 protected int m_SayShoutCount = 0;
112
108 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) 113 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
109 { 114 {
115 m_ShoutSayTimer = new Timer(1000);
116 m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed;
117 m_ShoutSayTimer.AutoReset = true;
118 m_ShoutSayTimer.Start();
119
110 m_ScriptEngine = ScriptEngine; 120 m_ScriptEngine = ScriptEngine;
111 m_host = host; 121 m_host = host;
112 m_localID = localID; 122 m_localID = localID;
@@ -883,6 +893,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
883 { 893 {
884 m_host.AddScriptLPS(1); 894 m_host.AddScriptLPS(1);
885 895
896 if (channelID == 0)
897 m_SayShoutCount++;
898
899 if (m_SayShoutCount >= 11)
900 ScriptSleep(2000);
901
886 if (m_scriptConsoleChannelEnabled && (channelID == m_scriptConsoleChannel)) 902 if (m_scriptConsoleChannelEnabled && (channelID == m_scriptConsoleChannel))
887 { 903 {
888 Console.WriteLine(text); 904 Console.WriteLine(text);
@@ -905,6 +921,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
905 { 921 {
906 m_host.AddScriptLPS(1); 922 m_host.AddScriptLPS(1);
907 923
924 if (channelID == 0)
925 m_SayShoutCount++;
926
927 if (m_SayShoutCount >= 11)
928 ScriptSleep(2000);
929
908 if (text.Length > 1023) 930 if (text.Length > 1023)
909 text = text.Substring(0, 1023); 931 text = text.Substring(0, 1023);
910 932
@@ -10972,6 +10994,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10972 10994
10973 return rq.ToString(); 10995 return rq.ToString();
10974 } 10996 }
10997
10998 private void SayShoutTimerElapsed(Object sender, ElapsedEventArgs args)
10999 {
11000 m_SayShoutCount = 0;
11001 }
10975 } 11002 }
10976 11003
10977 public class NotecardCache 11004 public class NotecardCache