From 83c113896ec518cef98880195f81bc6fe2d6a63f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Sep 2013 20:24:08 +0100
Subject: Create regression TestCrossOnSameSimulatorNoRootDestPerm() to check
that avatars are not allowed to cross into a neighbour where they are not
authorized, even if a child agent was allowed.
---
.../Scenes/Tests/ScenePresenceCrossingTests.cs | 86 ++++++++++++++++++++++
1 file changed, 86 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes/Tests')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index 12a778b..cf211a1 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -38,6 +38,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.CoreModules.Framework;
using OpenSim.Region.CoreModules.Framework.EntityTransfer;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
+using OpenSim.Region.CoreModules.World.Permissions;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
@@ -159,5 +160,90 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(agentMovementCompleteReceived, Is.EqualTo(1));
Assert.That(spAfterCrossSceneB.IsChildAgent, Is.False);
}
+
+ ///
+ /// Test a cross attempt where the user can see into the neighbour but does not have permission to become
+ /// root there.
+ ///
+ [Test]
+ public void TestCrossOnSameSimulatorNoRootDestPerm()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID userId = TestHelpers.ParseTail(0x1);
+
+ EntityTransferModule etmA = new EntityTransferModule();
+ EntityTransferModule etmB = new EntityTransferModule();
+ LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
+
+ IConfigSource config = new IniConfigSource();
+ IConfig modulesConfig = config.AddConfig("Modules");
+ modulesConfig.Set("EntityTransferModule", etmA.Name);
+ modulesConfig.Set("SimulationServices", lscm.Name);
+
+ SceneHelpers sh = new SceneHelpers();
+ TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
+ TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
+
+ SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
+ SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
+
+ // We need to set up the permisions module on scene B so that our later use of agent limit to deny
+ // QueryAccess won't succeed anyway because administrators are always allowed in and the default
+ // IsAdministrator if no permissions module is present is true.
+ SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), new PermissionsModule(), etmB);
+
+ AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
+ TestClient tc = new TestClient(acd, sceneA);
+ List destinationTestClients = new List();
+ EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
+
+ // Make sure sceneB will not accept this avatar.
+ sceneB.RegionInfo.EstateSettings.PublicAccess = false;
+
+ ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
+ originalSp.AbsolutePosition = new Vector3(128, 32, 10);
+
+ AgentUpdateArgs moveArgs = new AgentUpdateArgs();
+ //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero);
+ moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2)));
+ moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
+ moveArgs.SessionID = acd.SessionID;
+
+ originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs);
+
+ sceneA.Update(1);
+
+// Console.WriteLine("Second pos {0}", originalSp.AbsolutePosition);
+
+ // FIXME: This is a sufficient number of updates to for the presence to reach the northern border.
+ // But really we want to do this in a more robust way.
+ for (int i = 0; i < 100; i++)
+ {
+ sceneA.Update(1);
+// Console.WriteLine("Pos {0}", originalSp.AbsolutePosition);
+ }
+
+ // sceneA agent should still be root
+ ScenePresence spAfterCrossSceneA = sceneA.GetScenePresence(originalSp.UUID);
+ Assert.That(spAfterCrossSceneA.IsChildAgent, Is.False);
+
+ ScenePresence spAfterCrossSceneB = sceneB.GetScenePresence(originalSp.UUID);
+
+ // sceneB agent should also still be root
+ Assert.That(spAfterCrossSceneB.IsChildAgent, Is.True);
+
+ // sceneB should ignore unauthorized attempt to upgrade agent to root
+ TestClient sceneBTc = ((TestClient)spAfterCrossSceneB.ControllingClient);
+
+ int agentMovementCompleteReceived = 0;
+ sceneBTc.OnReceivedMoveAgentIntoRegion += (ri, pos, look) => agentMovementCompleteReceived++;
+
+ sceneBTc.CompleteMovement();
+
+ Assert.That(agentMovementCompleteReceived, Is.EqualTo(0));
+ Assert.That(spAfterCrossSceneB.IsChildAgent, Is.True);
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From 979b17165b7e504385187ab082ef0a8cd50605bd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Sep 2013 22:45:50 +0100
Subject: For debug purposes, allow simulators to force use of earlier
SIMULATION/0.1 teleport protocol even if SIMULATION/0.2 is available.
This is specified in the MaxOutgoingTransferVersion attribute of [EntityTransfer] in OpenSim.ini, see OpenSimDefaults.ini for more details.
Default remains "SIMULATION/0.2"
Primarily for http://opensimulator.org/mantis/view.php?id=6755
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes/Tests')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 8c25dbc..3ba34dd 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public void TestSameSimulatorIsolatedRegionsV2()
{
TestHelpers.InMethod();
-// TestHelpers.EnableLogging();
+ TestHelpers.EnableLogging();
UUID userId = TestHelpers.ParseTail(0x1);
--
cgit v1.1
From b16bc7b01ca0691758e66f85238d657f02271082 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 27 Sep 2013 19:14:21 +0100
Subject: refactor: rename Scene.IncomingCloseAgent() to CloseAgent() in order
to make it clear that all non-clientstack callers should be using this rather
than RemoveClient() in order to step through the ScenePresence state machine
properly.
Adds IScene.CloseAgent() to replace RemoveClient()
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 4 ++--
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Tests')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index bbe34d2..e25bcb7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
}
[Test]
- public void TestCloseAgent()
+ public void TestCloseClient()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
@@ -154,7 +154,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene scene = new SceneHelpers().SetupScene();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
- scene.IncomingCloseAgent(sp.UUID, false);
+ scene.CloseAgent(sp.UUID, false);
Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
index b6fb730..4fdfc74 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// TODO: Need to add tests for other ICapabiltiesModule methods.
- scene.IncomingCloseAgent(sp.UUID, false);
+ scene.CloseAgent(sp.UUID, false);
Assert.That(capsMod.GetCapsForUser(spUuid), Is.Null);
// TODO: Need to add tests for other ICapabiltiesModule methods.
--
cgit v1.1
From 2cd95fac736cc99b1a2ad661e4a03810225ffaca Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 27 Sep 2013 22:27:39 +0100
Subject: refactor: Rename Scene.AddNewClient() to AddNewAgent() to make it
obvious in the code that this is symmetric with CloseAgent()
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Tests')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index e25bcb7..d1aeaee 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// *** This is the second stage, where the client established a child agent/scene presence using the
// circuit code given to the scene in stage 1 ***
TestClient client = new TestClient(acd, scene);
- scene.AddNewClient(client, PresenceType.User);
+ scene.AddNewAgent(client, PresenceType.User);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
@@ -279,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// string reason;
// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
// testclient = new TestClient(agent, scene);
-// scene.AddNewClient(testclient);
+// scene.AddNewAgent(testclient);
//
// ScenePresence presence = scene.GetScenePresence(agent1);
//
--
cgit v1.1
From 8996ac1a9cde74cc17676411b0f1c58bcc63d179 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 27 Sep 2013 22:33:42 +0100
Subject: minor: Disable logging left active on regression test
TestSameSimulatorIsolatedRegionsV2()
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes/Tests')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 3ba34dd..8c25dbc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public void TestSameSimulatorIsolatedRegionsV2()
{
TestHelpers.InMethod();
- TestHelpers.EnableLogging();
+// TestHelpers.EnableLogging();
UUID userId = TestHelpers.ParseTail(0x1);
--
cgit v1.1