aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2014-11-11 20:42:42 -0800
committerDiva Canto2014-11-11 20:42:42 -0800
commit1a02e5d2db2122cde79f743d69c6ad6aacfe0a08 (patch)
treeb35c2c97a806b011174fa610367a09ce72f4a1a9 /OpenSim/Region
parentFix the fetching of module references in the viewer support modules. (diff)
parentFix issue where llRemoteLoadScriptPin() would treat 0 (the default) as a vali... (diff)
downloadopensim-SC_OLD-1a02e5d2db2122cde79f743d69c6ad6aacfe0a08.zip
opensim-SC_OLD-1a02e5d2db2122cde79f743d69c6ad6aacfe0a08.tar.gz
opensim-SC_OLD-1a02e5d2db2122cde79f743d69c6ad6aacfe0a08.tar.bz2
opensim-SC_OLD-1a02e5d2db2122cde79f743d69c6ad6aacfe0a08.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs48
2 files changed, 60 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 3c120ff..5cc5606 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1940,8 +1940,11 @@ namespace OpenSim.Region.Framework.Scenes
1940 /// Rez a script into a prim's inventory from another prim 1940 /// Rez a script into a prim's inventory from another prim
1941 /// </summary> 1941 /// </summary>
1942 /// <param name="remoteClient"></param> 1942 /// <param name="remoteClient"></param>
1943 /// <param name="itemID"> </param> 1943 /// <param name="srcPart"> </param>
1944 /// <param name="localID"></param> 1944 /// <param name="destId"> </param>
1945 /// <param name="pin"></param>
1946 /// <param name="running"></param>
1947 /// <param name="start_param"></param>
1945 public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) 1948 public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param)
1946 { 1949 {
1947 TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); 1950 TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId);
@@ -1961,12 +1964,11 @@ namespace OpenSim.Region.Framework.Scenes
1961 if (destPart == null) 1964 if (destPart == null)
1962 { 1965 {
1963 m_log.ErrorFormat( 1966 m_log.ErrorFormat(
1964 "[PRIM INVENTORY]: " + 1967 "[PRIM INVENTORY]: Could not find part {0} to insert script item {1} from {2} {3} in {4}",
1965 "Could not find script for ID {0}", 1968 destId, srcId, srcPart.Name, srcPart.UUID, Name);
1966 destId);
1967 return; 1969 return;
1968 } 1970 }
1969 1971
1970 // Must own the object, and have modify rights 1972 // Must own the object, and have modify rights
1971 if (srcPart.OwnerID != destPart.OwnerID) 1973 if (srcPart.OwnerID != destPart.OwnerID)
1972 { 1974 {
@@ -1974,12 +1976,14 @@ namespace OpenSim.Region.Framework.Scenes
1974 if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) || 1976 if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) ||
1975 ((destPart.GroupMask & (uint)PermissionMask.Modify) == 0)) 1977 ((destPart.GroupMask & (uint)PermissionMask.Modify) == 0))
1976 return; 1978 return;
1977 } else { 1979 }
1980 else
1981 {
1978 if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0) 1982 if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
1979 return; 1983 return;
1980 } 1984 }
1981 1985
1982 if (destPart.ScriptAccessPin != pin) 1986 if (destPart.ScriptAccessPin == 0 || destPart.ScriptAccessPin != pin)
1983 { 1987 {
1984 m_log.WarnFormat( 1988 m_log.WarnFormat(
1985 "[PRIM INVENTORY]: " + 1989 "[PRIM INVENTORY]: " +
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 37caa5d..1ad0a99 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -238,5 +238,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
238 Assert.IsNotNull(receivedItem); 238 Assert.IsNotNull(receivedItem);
239 Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify); 239 Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify);
240 } 240 }
241
242 [Test]
243 public void TestLlRemoteLoadScriptPin()
244 {
245 TestHelpers.InMethod();
246// TestHelpers.EnableLogging();
247
248 UUID user1Id = TestHelpers.ParseTail(0x1);
249 UUID user2Id = TestHelpers.ParseTail(0x2);
250
251 SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, 1, user1Id, "sourceSo", 0x10);
252 m_scene.AddSceneObject(sourceSo);
253 LSL_Api api = new LSL_Api();
254 api.Initialize(m_engine, sourceSo.RootPart, null, null);
255 TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World");
256
257 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, 1, user1Id, "targetSo", 0x20);
258 SceneObjectGroup otherOwnedTargetSo
259 = SceneHelpers.AddSceneObject(m_scene, 1, user2Id, "otherOwnedTargetSo", 0x30);
260
261 // Test that we cannot load a script when the target pin has never been set (i.e. it is zero)
262 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 0, 0, 0);
263 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
264
265 // Test that we cannot load a script when the given pin does not match the target
266 targetSo.RootPart.ScriptAccessPin = 5;
267 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
268 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
269
270 // Test that we cannot load into a prim with a different owner
271 otherOwnedTargetSo.RootPart.ScriptAccessPin = 3;
272 api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
273 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
274
275 // Test that we can load a script when given pin and dest pin match.
276 targetSo.RootPart.ScriptAccessPin = 3;
277 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
278 TaskInventoryItem insertedItem = targetSo.RootPart.Inventory.GetInventoryItem("script");
279 Assert.IsNotNull(insertedItem);
280
281 // Test that we can no longer load if access pin is unset
282 targetSo.RootPart.Inventory.RemoveInventoryItem(insertedItem.ItemID);
283 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
284
285 targetSo.RootPart.ScriptAccessPin = 0;
286 api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
287 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
288 }
241 } 289 }
242} \ No newline at end of file 290} \ No newline at end of file