mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
Thank you, thomax, for a patch to provide finer-grained access control to
scripting. Fixes Mantis #2862
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user