aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2008-12-09 13:24:01 +0000
committerSean Dague2008-12-09 13:24:01 +0000
commit04e8d624d6223e3cea183e7a7d605151db93dbbf (patch)
tree524f3983719d91c81eb7d7c014c0f25250c33d86 /OpenSim
parentMinor formatting cleanup. (diff)
downloadopensim-SC_OLD-04e8d624d6223e3cea183e7a7d605151db93dbbf.zip
opensim-SC_OLD-04e8d624d6223e3cea183e7a7d605151db93dbbf.tar.gz
opensim-SC_OLD-04e8d624d6223e3cea183e7a7d605151db93dbbf.tar.bz2
opensim-SC_OLD-04e8d624d6223e3cea183e7a7d605151db93dbbf.tar.xz
From: Christopher Yeoh <yeohc@au1.ibm.com>
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs19
1 files changed, 15 insertions, 4 deletions
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
78 78
79 private DateTime m_timer = DateTime.Now; 79 private DateTime m_timer = DateTime.Now;
80 private bool m_waitingForScriptAnswer=false; 80 private bool m_waitingForScriptAnswer=false;
81 private bool m_automaticLinkPermission=false;
81 82
82 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 83 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
83 84
@@ -94,6 +95,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
94 m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f); 95 m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
95 m_MinTimerInterval = 96 m_MinTimerInterval =
96 m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); 97 m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f);
98 m_automaticLinkPermission =
99 m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
97 100
98 AsyncCommands = new AsyncCommandManager(ScriptEngine); 101 AsyncCommands = new AsyncCommandManager(ScriptEngine);
99 } 102 }
@@ -3021,7 +3024,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3021 { 3024 {
3022 if (item.Type == 10 && item.ItemID == m_itemID) 3025 if (item.Type == 10 && item.ItemID == m_itemID)
3023 { 3026 {
3024 return item.PermsMask; 3027 int perms = item.PermsMask;
3028 if (m_automaticLinkPermission)
3029 perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
3030 return perms;
3025 } 3031 }
3026 } 3032 }
3027 3033
@@ -3054,10 +3060,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3054 { 3060 {
3055 m_host.AddScriptLPS(1); 3061 m_host.AddScriptLPS(1);
3056 UUID invItemID = InventorySelf(); 3062 UUID invItemID = InventorySelf();
3057 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0) { 3063 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3064 && !m_automaticLinkPermission)
3065 {
3058 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 3066 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
3059 return; 3067 return;
3060 } 3068 }
3069
3061 IClientAPI client = null; 3070 IClientAPI client = null;
3062 ScenePresence sp = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter); 3071 ScenePresence sp = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
3063 if (sp != null) 3072 if (sp != null)
@@ -3087,7 +3096,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3087 parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected); 3096 parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected);
3088 parentPrim.HasGroupChanged = true; 3097 parentPrim.HasGroupChanged = true;
3089 parentPrim.ScheduleGroupForFullUpdate(); 3098 parentPrim.ScheduleGroupForFullUpdate();
3090 parentPrim.GetProperties(client); 3099 if (client!=null)
3100 parentPrim.GetProperties(client);
3091 3101
3092 ScriptSleep(1000); 3102 ScriptSleep(1000);
3093 } 3103 }
@@ -3096,7 +3106,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3096 { 3106 {
3097 m_host.AddScriptLPS(1); 3107 m_host.AddScriptLPS(1);
3098 UUID invItemID = InventorySelf(); 3108 UUID invItemID = InventorySelf();
3099 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0) 3109 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3110 && !m_automaticLinkPermission)
3100 { 3111 {
3101 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 3112 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
3102 return; 3113 return;