aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie Thielker2009-06-05 09:47:42 +0000
committerMelanie Thielker2009-06-05 09:47:42 +0000
commit9f932a42057b4a9cd4517c90007a7c31c98277c6 (patch)
treeb0183d1d5317e9408c73924a3a97cb31e3a4adf7 /OpenSim/Region/ScriptEngine
parent* convenience ignores (diff)
downloadopensim-SC-9f932a42057b4a9cd4517c90007a7c31c98277c6.zip
opensim-SC-9f932a42057b4a9cd4517c90007a7c31c98277c6.tar.gz
opensim-SC-9f932a42057b4a9cd4517c90007a7c31c98277c6.tar.bz2
opensim-SC-9f932a42057b4a9cd4517c90007a7c31c98277c6.tar.xz
Thank you, thomax, for a patch to provide finer-grained access control to
scripting. Fixes Mantis #2862
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs2
4 files changed, 13 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 9897267..15d6c2c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
153 // Compile (We assume LSL) 153 // Compile (We assume LSL)
154 CompiledScriptFile = 154 CompiledScriptFile =
155 LSLCompiler.PerformScriptCompile(Script, 155 LSLCompiler.PerformScriptCompile(Script,
156 assetID.ToString()); 156 assetID.ToString(), taskInventoryItem.OwnerID);
157 157
158 if (presence != null && (!postOnRez)) 158 if (presence != null && (!postOnRez))
159 presence.ControllingClient.SendAgentAlertMessage( 159 presence.ControllingClient.SendAgentAlertMessage(
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
index 1bba878..2fd819d 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
@@ -27,13 +27,14 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse;
30using Nini.Config; 31using Nini.Config;
31 32
32namespace OpenSim.Region.ScriptEngine.Interfaces 33namespace OpenSim.Region.ScriptEngine.Interfaces
33{ 34{
34 public interface ICompiler 35 public interface ICompiler
35 { 36 {
36 string PerformScriptCompile(string source, string asset); 37 string PerformScriptCompile(string source, string asset, UUID ownerID);
37 string[] GetWarnings(); 38 string[] GetWarnings();
38 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> 39 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
39 LineMap(); 40 LineMap();
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index fcb3339..911da5b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -37,6 +37,7 @@ using Microsoft.VisualBasic;
37using log4net; 37using log4net;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.ScriptEngine.Interfaces; 39using OpenSim.Region.ScriptEngine.Interfaces;
40using OpenMetaverse;
40 41
41namespace OpenSim.Region.ScriptEngine.Shared.CodeTools 42namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
42{ 43{
@@ -263,7 +264,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
263 /// </summary> 264 /// </summary>
264 /// <param name="Script">LSL script</param> 265 /// <param name="Script">LSL script</param>
265 /// <returns>Filename to .dll assembly</returns> 266 /// <returns>Filename to .dll assembly</returns>
266 public string PerformScriptCompile(string Script, string asset) 267 public string PerformScriptCompile(string Script, string asset, UUID ownerUUID)
267 { 268 {
268 m_positionMap = null; 269 m_positionMap = null;
269 m_warnings.Clear(); 270 m_warnings.Clear();
@@ -341,6 +342,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
341 throw new Exception(errtext); 342 throw new Exception(errtext);
342 } 343 }
343 344
345 if(m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)l) == false) {
346 // Not allowed to compile to this language!
347 string errtext = String.Empty;
348 errtext += ownerUUID + " is not in list of allowed users for this scripting language. Script will not be executed!";
349 throw new Exception(errtext);
350 }
351
344 string compileScript = Script; 352 string compileScript = Script;
345 353
346 if (l == enumCompileType.lsl) 354 if (l == enumCompileType.lsl)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index cfabda1..34f8145 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -579,7 +579,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
579 lock (m_AddingAssemblies) 579 lock (m_AddingAssemblies)
580 { 580 {
581 assembly = m_Compiler.PerformScriptCompile(script, 581 assembly = m_Compiler.PerformScriptCompile(script,
582 assetID.ToString()); 582 assetID.ToString(), item.OwnerID);
583 if (!m_AddingAssemblies.ContainsKey(assembly)) { 583 if (!m_AddingAssemblies.ContainsKey(assembly)) {
584 m_AddingAssemblies[assembly] = 1; 584 m_AddingAssemblies[assembly] = 1;
585 } else { 585 } else {