From cffd73c59fb8cba3b93a1555173e3f4d5cda1258 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 3 Oct 2008 06:15:23 +0000 Subject: Reintroduces the discovery mechanism to use llRequestSimulatorData("", 128) Causes the dataserver event to return "OpenSim" when running on OpenSim. Requires ThreatLevel to be "High" or above to function. --- .../Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | 5 +++++ .../Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 17 +++++++++++++++++ .../Region/ScriptEngine/Interfaces/IEventReceiver.cs | 1 + OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs | 2 -- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 +++++++ .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 +------------- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 14 ++++++++++++++ 7 files changed, 45 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 76bf41b..433a1c2 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -372,5 +372,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine controllingClient.SendScriptRunningReply(objectID, itemID, id.Running); } + + public IScriptApi GetApi(UUID itemID, string name) + { + return m_ScriptManager.GetApi(itemID, name); + } } } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 875b29e..fc6024a 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -619,7 +619,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine InstanceData id = GetScript(localID, itemID); + if (id == null) + return 0; + return id.StartParam; } + + public IScriptApi GetApi(UUID itemID, string name) + { + uint localID = GetLocalID(itemID); + + InstanceData id = GetScript(localID, itemID); + if (id == null) + return null; + + if (id.Apis.ContainsKey(name)) + return id.Apis[name]; + + return null; + } } } diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IEventReceiver.cs b/OpenSim/Region/ScriptEngine/Interfaces/IEventReceiver.cs index 084e279..898d670 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IEventReceiver.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IEventReceiver.cs @@ -66,5 +66,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces IConfig Config { get; } string ScriptEngineName { get; } ILog Log { get; } + IScriptApi GetApi(UUID itemID, string name); } } diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index ccfbca8..5bd2f79 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs @@ -46,7 +46,5 @@ namespace OpenSim.Region.ScriptEngine.Interfaces /// Queue an event for execution /// IScriptWorkItem QueueEventHandler(object parms); - - IScriptApi GetApi(UUID itemID, string name); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4ae4fe2..783b1e4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7182,6 +7182,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llRequestSimulatorData(string simulator, int data) { + IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); + try { m_host.AddScriptLPS(1); @@ -7223,6 +7225,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else reply = "UNKNOWN"; break; + case 128: + if (ossl != null) + ossl.CheckThreatLevel(ThreatLevel.High, "llRequestSimulatorData"); + reply = "OpenSim"; + break; default: // ScriptSleep(1000); return UUID.Zero.ToString(); // Raise no event diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c5e6359..bfe289c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -87,18 +87,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // modification of user data, or allows the compromise of // sensitive data by design. - public enum ThreatLevel - { - None = 0, - Nuisance = 1, - VeryLow = 2, - Low = 3, - Moderate = 4, - High = 5, - VeryHigh = 6, - Severe = 7 - }; - [Serializable] public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi { @@ -180,7 +168,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api throw new Exception("OSSL Runtime Error: " + msg); } - protected void CheckThreatLevel(ThreatLevel level, string function) + public void CheckThreatLevel(ThreatLevel level, string function) { if (!m_OSFunctionsEnabled) OSSLError(function+": permission denied"); // throws diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index f486bd2..48eddd2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -28,8 +28,22 @@ using System.Collections; using OpenSim.Region.ScriptEngine.Interfaces; namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces { + public enum ThreatLevel + { + None = 0, + Nuisance = 1, + VeryLow = 2, + Low = 3, + Moderate = 4, + High = 5, + VeryHigh = 6, + Severe = 7 + }; + public interface IOSSL_Api { + void CheckThreatLevel(ThreatLevel level, string function); + //OpenSim functions string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, -- cgit v1.1