diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 514a65b282..f9e2b2f05b 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -433,11 +433,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string reason;
string version;
- if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
+ if (!m_aScene.SimulationService.QueryAccess(
+ finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
{
- sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
+ sp.ControllingClient.SendTeleportFailed(reason);
ResetFromTransit(sp.UUID);
+ m_log.DebugFormat(
+ "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}",
+ sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason);
+
return;
}
@@ -480,10 +485,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
bool logout = false;
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
{
- sp.ControllingClient.SendTeleportFailed(
- String.Format("Teleport refused: {0}", reason));
+ sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason));
ResetFromTransit(sp.UUID);
+ m_log.DebugFormat(
+ "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}",
+ sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason);
+
return;
}
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 190f63bf7d..8c97f58f26 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -450,19 +450,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
///
- /// Is the given user an administrator (in other words, a god)?
+ /// Is the user regarded as an administrator?
///
///
///
protected bool IsAdministrator(UUID user)
{
- if (user == UUID.Zero) return false;
-
- if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
- {
- if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod)
- return true;
- }
+ if (user == UUID.Zero)
+ return false;
+
+ if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod)
+ return true;
if (IsEstateManager(user) && m_RegionManagerIsGod)
return true;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 34362bf670..8a6a6b4d92 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -4139,35 +4139,6 @@ namespace OpenSim.Region.Framework.Scenes
switch (m_scene.SpawnPointRouting)
{
- case "closest":
-
- float distance = 9999;
- int closest = -1;
-
- for (int i = 0; i < spawnPoints.Length; i++)
- {
- Vector3 spawnPosition = spawnPoints[i].GetLocation(
- telehub.AbsolutePosition,
- telehub.GroupRotation
- );
- Vector3 offset = spawnPosition - pos;
- float d = Vector3.Mag(offset);
- if (d >= distance)
- continue;
- ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
- if (land == null)
- continue;
- if (land.IsEitherBannedOrRestricted(UUID))
- continue;
- distance = d;
- closest = i;
- }
- if (closest == -1)
- return;
-
- pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
- return;
-
case "random":
do
@@ -4219,7 +4190,35 @@ namespace OpenSim.Region.Framework.Scenes
return;
default:
+ case "closest":
+
+ float distance = 9999;
+ int closest = -1;
+
+ for (int i = 0; i < spawnPoints.Length; i++)
+ {
+ Vector3 spawnPosition = spawnPoints[i].GetLocation(
+ telehub.AbsolutePosition,
+ telehub.GroupRotation
+ );
+ Vector3 offset = spawnPosition - pos;
+ float d = Vector3.Mag(offset);
+ if (d >= distance)
+ continue;
+ ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
+ if (land == null)
+ continue;
+ if (land.IsEitherBannedOrRestricted(UUID))
+ continue;
+ distance = d;
+ closest = i;
+ }
+ if (closest == -1)
+ return;
+
+ pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
return;
+
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index ea4fb66b4e..41bff7f92e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -37,6 +37,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;
using System.IO;
@@ -161,6 +162,148 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
}
+ ///
+ /// Test teleport procedures when the target simulator returns false when queried about access.
+ ///
+ [Test]
+ public void TestSameSimulatorSeparatedRegionsQueryAccessFails()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID userId = TestHelpers.ParseTail(0x1);
+ Vector3 preTeleportPosition = new Vector3(30, 31, 32);
+
+ EntityTransferModule etm = new EntityTransferModule();
+ LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
+
+ IConfigSource config = new IniConfigSource();
+ config.AddConfig("Modules");
+ config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
+ config.Configs["Modules"].Set("SimulationServices", lscm.Name);
+
+ config.AddConfig("EntityTransfer");
+
+ // In order to run a single threaded regression test we do not want the entity transfer module waiting
+ // for a callback from the destination scene before removing its avatar data.
+ config.Configs["EntityTransfer"].Set("wait_for_callback", false);
+
+ config.AddConfig("Startup");
+ config.Configs["Startup"].Set("serverside_object_permissions", true);
+
+ SceneHelpers sh = new SceneHelpers();
+ TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
+ TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
+
+ // 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 object[] { new PermissionsModule() });
+
+ // Shared scene modules
+ SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
+
+ Vector3 teleportPosition = new Vector3(10, 11, 12);
+ Vector3 teleportLookAt = new Vector3(20, 21, 22);
+
+ ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
+ sp.AbsolutePosition = preTeleportPosition;
+
+ // Make sceneB return false on query access
+ sceneB.RegionInfo.RegionSettings.AgentLimit = 0;
+
+ sceneA.RequestTeleportLocation(
+ sp.ControllingClient,
+ sceneB.RegionInfo.RegionHandle,
+ teleportPosition,
+ teleportLookAt,
+ (uint)TeleportFlags.ViaLocation);
+
+// ((TestClient)sp.ControllingClient).CompleteTeleportClientSide();
+
+ Assert.That(sceneB.GetScenePresence(userId), Is.Null);
+
+ ScenePresence sceneASp = sceneA.GetScenePresence(userId);
+ Assert.That(sceneASp, Is.Not.Null);
+ Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
+ Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
+
+ // TODO: Add assertions to check correct circuit details in both scenes.
+
+ // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
+ // position instead).
+// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
+
+// TestHelpers.DisableLogging();
+ }
+
+ ///
+ /// Test teleport procedures when the target simulator create agent step is refused.
+ ///
+ [Test]
+ public void TestSameSimulatorSeparatedRegionsCreateAgentFails()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID userId = TestHelpers.ParseTail(0x1);
+ Vector3 preTeleportPosition = new Vector3(30, 31, 32);
+
+ EntityTransferModule etm = new EntityTransferModule();
+ LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
+
+ IConfigSource config = new IniConfigSource();
+ config.AddConfig("Modules");
+ config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
+ config.Configs["Modules"].Set("SimulationServices", lscm.Name);
+
+ config.AddConfig("EntityTransfer");
+
+ // In order to run a single threaded regression test we do not want the entity transfer module waiting
+ // for a callback from the destination scene before removing its avatar data.
+ config.Configs["EntityTransfer"].Set("wait_for_callback", false);
+
+ SceneHelpers sh = new SceneHelpers();
+ TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
+ TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
+
+ // Shared scene modules
+ SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
+
+ Vector3 teleportPosition = new Vector3(10, 11, 12);
+ Vector3 teleportLookAt = new Vector3(20, 21, 22);
+
+ ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
+ sp.AbsolutePosition = preTeleportPosition;
+
+ // Make sceneB refuse CreateAgent
+ sceneB.LoginsDisabled = true;
+
+ sceneA.RequestTeleportLocation(
+ sp.ControllingClient,
+ sceneB.RegionInfo.RegionHandle,
+ teleportPosition,
+ teleportLookAt,
+ (uint)TeleportFlags.ViaLocation);
+
+// ((TestClient)sp.ControllingClient).CompleteTeleportClientSide();
+
+ Assert.That(sceneB.GetScenePresence(userId), Is.Null);
+
+ ScenePresence sceneASp = sceneA.GetScenePresence(userId);
+ Assert.That(sceneASp, Is.Not.Null);
+ Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
+ Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
+
+ // TODO: Add assertions to check correct circuit details in both scenes.
+
+ // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
+ // position instead).
+// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
+
+// TestHelpers.DisableLogging();
+ }
+
[Test]
public void TestSameSimulatorNeighbouringRegionsTeleport()
{
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs
index 6744fcac97..d38d692ed6 100644
--- a/OpenSim/Tests/Common/TestHelpers.cs
+++ b/OpenSim/Tests/Common/TestHelpers.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Tests.Common
private static Stream DisableLoggingConfigStream
= new MemoryStream(
Encoding.UTF8.GetBytes(
- // "")));
+// ""));
//"")));
// ""));
// "")));
@@ -100,6 +100,12 @@ namespace OpenSim.Tests.Common
///
/// Disable logging whilst running the tests.
///
+ ///
+ /// Remember, if a regression test throws an exception before completing this will not be invoked if it's at
+ /// the end of the test.
+ /// TODO: Always invoke this after every test - probably need to make all test cases inherit from a common
+ /// TestCase class where this can be done.
+ ///
public static void DisableLogging()
{
log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream);
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 9b88816893..9f418a40dd 100755
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -241,12 +241,12 @@
;; server to send mail through.
; emailmodule = DefaultEmailModule
- ;# {SpawnPointRouting} {} {Set routing method for Telehub Spawnpoints} {closest random sequential} closest
+ ;# {SpawnPointRouting} {} {Set routing method for Telehub Spawnpoints} {closest random sequence} closest
;; SpawnPointRouting adjusts the landing for incoming avatars.
;; "closest" will place the avatar at the SpawnPoint located in the closest
;; available spot to the destination (typically map click/landmark).
;; "random" will place the avatar on a randomly selected spawnpoint;
- ;; "sequential" will place the avatar on the next sequential SpawnPoint
+ ;; "sequence" will place the avatar on the next sequential SpawnPoint
; SpawnPointRouting = closest
[Estates]