From 04e8d624d6223e3cea183e7a7d605151db93dbbf Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 9 Dec 2008 13:24:01 +0000 Subject: From: Christopher Yeoh The attached patch ads an OpenSim.ini option (AutomaticLinkPermission) which when enabled makes PERMISSION_CHANGE_LINKS to be granted to scripts by default. When enabled llGetPermissions will always return it as granted and llCreateLink//llBreakLink will succeed without doing llRequestPermissions. ONLY ENABLE THIS IN TRUSTED ENVIRONMENTS. The patch also fixes a minor bug in llCreateLink related to a potential dereference of a null client object. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 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 43ffb30..1189e86 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -78,6 +78,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private DateTime m_timer = DateTime.Now; private bool m_waitingForScriptAnswer=false; + private bool m_automaticLinkPermission=false; //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -94,6 +95,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f); m_MinTimerInterval = m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); + m_automaticLinkPermission = + m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false); AsyncCommands = new AsyncCommandManager(ScriptEngine); } @@ -3021,7 +3024,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (item.Type == 10 && item.ItemID == m_itemID) { - return item.PermsMask; + int perms = item.PermsMask; + if (m_automaticLinkPermission) + perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; + return perms; } } @@ -3054,10 +3060,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); UUID invItemID = InventorySelf(); - if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0) { + if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 + && !m_automaticLinkPermission) + { ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); return; } + IClientAPI client = null; ScenePresence sp = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter); if (sp != null) @@ -3087,7 +3096,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected); parentPrim.HasGroupChanged = true; parentPrim.ScheduleGroupForFullUpdate(); - parentPrim.GetProperties(client); + if (client!=null) + parentPrim.GetProperties(client); ScriptSleep(1000); } @@ -3096,7 +3106,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); UUID invItemID = InventorySelf(); - if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0) + if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 + && !m_automaticLinkPermission) { ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); return; -- cgit v1.1