From bf8b70ebeb82485047d61ae197bb037320bace5f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 15 Sep 2008 15:36:51 +0000 Subject: Add the option to use Allow_osFunction = false for each OS function in the XEngine section --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c834cc8..cba0757 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; +using System.Collections.Generic; using System.Runtime.Remoting.Lifetime; using OpenMetaverse; using Nini.Config; @@ -106,6 +107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; internal float m_ScriptDelayFactor = 1.0f; internal float m_ScriptDistanceFactor = 1.0f; + internal Dictionary m_FunctionPerms = new Dictionary(); public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) { @@ -177,6 +179,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void CheckThreatLevel(ThreatLevel level, string function) { + if (!m_FunctionPerms.ContainsKey(function)) + { + m_FunctionPerms[function] = + m_ScriptEngine.Config.GetBoolean("Allow_"+function, true); + } + + if (!m_FunctionPerms[function]) + return; + if (level > m_MaxThreatLevel) throw new Exception("Threat level too high - "+function); } -- cgit v1.1