From 296d63e20b0b77ba70257726ae519ef733865534 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 12 Mar 2014 23:05:16 +0000
Subject: Implement osForceCreateLink() and osForceBreakLink()
These are identical to llCreateLink() and llBreakLink() except that they don't require script permissions.
However, osForceCreateLink() still requires that linked and linkee still have the same owner.
There's also an AutomaticLinkPermission setting in [XEngine] that could be set to true to prevent the LSL function checks.
But this doesn't allow the finer control over which users/scripts, etc. can do this that the OSSL functions provide.
---
.../Shared/Api/Implementation/LSL_Api.cs | 27 +++++++++++++++-------
.../Shared/Api/Implementation/OSSL_Api.cs | 20 ++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 13 +++++++++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++++++
4 files changed, 62 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b333b55..45a7c96 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3769,10 +3769,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llCreateLink(string target, int parent)
{
m_host.AddScriptLPS(1);
- UUID targetID;
-
- if (!UUID.TryParse(target, out targetID))
- return;
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
@@ -3781,10 +3777,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
- IClientAPI client = null;
- ScenePresence sp = World.GetScenePresence(m_item.PermsGranter);
- if (sp != null)
- client = sp.ControllingClient;
+ CreateLink(target, parent);
+ }
+
+ public void CreateLink(string target, int parent)
+ {
+ UUID targetID;
+
+ if (!UUID.TryParse(target, out targetID))
+ return;
SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID);
@@ -3819,6 +3820,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
parentPrim.HasGroupChanged = true;
parentPrim.ScheduleGroupForFullUpdate();
+ IClientAPI client = null;
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+ if (sp != null)
+ client = sp.ControllingClient;
+
if (client != null)
parentPrim.SendPropertiesToClient(client);
@@ -3836,6 +3842,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
+ BreakLink(linknum);
+ }
+
+ public void BreakLink(int linknum)
+ {
if (linknum < ScriptBaseClass.LINK_THIS)
return;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 4cd683c..cfc48e9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2330,6 +2330,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return retVal;
}
+ public void osForceCreateLink(string target, int parent)
+ {
+ CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink");
+
+ m_host.AddScriptLPS(1);
+
+ InitLSL();
+ ((LSL_Api)m_LSL_Api).CreateLink(target, parent);
+ }
+
+ public void osForceBreakLink(int linknum)
+ {
+ CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink");
+
+ m_host.AddScriptLPS(1);
+
+ InitLSL();
+ ((LSL_Api)m_LSL_Api).BreakLink(linknum);
+ }
+
public LSL_Integer osIsNpc(LSL_Key npc)
{
CheckThreatLevel(ThreatLevel.None, "osIsNpc");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 519779e..b5de355 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -294,6 +294,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
///
+ /// Identical to llCreateLink() but does not require permission from the owner.
+ ///
+ ///
+ ///
+ void osForceCreateLink(string target, int parent);
+
+ ///
+ /// Identical to llBreakLink() but does not require permission from the owner.
+ ///
+ ///
+ void osForceBreakLink(int linknum);
+
+ ///
/// Check if the given key is an npc
///
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 9c060e5..7d5e568 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -542,6 +542,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules);
}
+ public void osForceCreateLink(string target, int parent)
+ {
+ m_OSSL_Functions.osForceCreateLink(target, parent);
+ }
+
+ public void osForceBreakLink(int linknum)
+ {
+ m_OSSL_Functions.osForceBreakLink(linknum);
+ }
+
public LSL_Integer osIsNpc(LSL_Key npc)
{
return m_OSSL_Functions.osIsNpc(npc);
--
cgit v1.1