Thank you, thomax, for a patch to provide finer-grained access control to

scripting.
Fixes Mantis #2862
This commit is contained in:
Melanie Thielker
2009-06-05 09:47:42 +00:00
parent d3ae3d7e72
commit 9f932a4205
6 changed files with 102 additions and 4 deletions

View File

@@ -153,7 +153,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Compile (We assume LSL)
CompiledScriptFile =
LSLCompiler.PerformScriptCompile(Script,
assetID.ToString());
assetID.ToString(), taskInventoryItem.OwnerID);
if (presence != null && (!postOnRez))
presence.ControllingClient.SendAgentAlertMessage(

View File

@@ -27,13 +27,14 @@
using System;
using System.Collections.Generic;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.ScriptEngine.Interfaces
{
public interface ICompiler
{
string PerformScriptCompile(string source, string asset);
string PerformScriptCompile(string source, string asset, UUID ownerID);
string[] GetWarnings();
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
LineMap();

View File

@@ -37,6 +37,7 @@ using Microsoft.VisualBasic;
using log4net;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.ScriptEngine.Interfaces;
using OpenMetaverse;
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
{
@@ -263,7 +264,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
/// </summary>
/// <param name="Script">LSL script</param>
/// <returns>Filename to .dll assembly</returns>
public string PerformScriptCompile(string Script, string asset)
public string PerformScriptCompile(string Script, string asset, UUID ownerUUID)
{
m_positionMap = null;
m_warnings.Clear();
@@ -341,6 +342,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
throw new Exception(errtext);
}
if(m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)l) == false) {
// Not allowed to compile to this language!
string errtext = String.Empty;
errtext += ownerUUID + " is not in list of allowed users for this scripting language. Script will not be executed!";
throw new Exception(errtext);
}
string compileScript = Script;
if (l == enumCompileType.lsl)

View File

@@ -579,7 +579,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
lock (m_AddingAssemblies)
{
assembly = m_Compiler.PerformScriptCompile(script,
assetID.ToString());
assetID.ToString(), item.OwnerID);
if (!m_AddingAssemblies.ContainsKey(assembly)) {
m_AddingAssemblies[assembly] = 1;
} else {