From 3ff7391495271fed152aadc7a588ae976e09bafc Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 29 Apr 2013 00:55:34 +0100
Subject: Some more pieces of Avination's ban system - if an avatar isn't
allowed on any parcel in the sim, keep them out entirely.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 95 +++++++++++++++++++++++++++++---
1 file changed, 88 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 69fe137..829a7e9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3693,7 +3693,7 @@ namespace OpenSim.Region.Framework.Scenes
//On login test land permisions
if (vialogin)
{
- if (land != null && !TestLandRestrictions(agent, land, out reason))
+ if (land != null && !TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y))
{
return false;
}
@@ -3868,20 +3868,37 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
- private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason)
+ public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
{
- bool banned = land.IsBannedFromLand(agent.AgentID);
- bool restricted = land.IsRestrictedFromLand(agent.AgentID);
+ if (posX < 0)
+ posX = 0;
+ else if (posX >= 256)
+ posX = 255.999f;
+ if (posY < 0)
+ posY = 0;
+ else if (posY >= 256)
+ posY = 255.999f;
+
+ reason = String.Empty;
+ if (Permissions.IsGod(agentID))
+ return true;
+
+ ILandObject land = LandChannel.GetLandObject(posX, posY);
+ if (land == null)
+ return false;
+
+ bool banned = land.IsBannedFromLand(agentID);
+ bool restricted = land.IsRestrictedFromLand(agentID);
if (banned || restricted)
{
- ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y);
+ ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY);
if (nearestParcel != null)
{
//Move agent to nearest allowed
Vector3 newPosition = GetParcelCenterAtGround(nearestParcel);
- agent.startpos.X = newPosition.X;
- agent.startpos.Y = newPosition.Y;
+ posX = newPosition.X;
+ posY = newPosition.Y;
}
else
{
@@ -5466,6 +5483,8 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
{
+ reason = "You are banned from the region";
+
if (EntityTransferModule.IsInTransit(agentID))
{
reason = "Agent is still in transit from this region";
@@ -5477,6 +5496,12 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
+ if (Permissions.IsGod(agentID))
+ {
+ reason = String.Empty;
+ return true;
+ }
+
// FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
// However, the long term fix is to make sure root agent count is always accurate.
m_sceneGraph.RecalculateStats();
@@ -5497,6 +5522,41 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ ScenePresence presence = GetScenePresence(agentID);
+ IClientAPI client = null;
+ AgentCircuitData aCircuit = null;
+
+ if (presence != null)
+ {
+ client = presence.ControllingClient;
+ if (client != null)
+ aCircuit = client.RequestClientInfo();
+ }
+
+ // We may be called before there is a presence or a client.
+ // Fake AgentCircuitData to keep IAuthorizationModule smiling
+ if (client == null)
+ {
+ aCircuit = new AgentCircuitData();
+ aCircuit.AgentID = agentID;
+ aCircuit.firstname = String.Empty;
+ aCircuit.lastname = String.Empty;
+ }
+
+ try
+ {
+ if (!AuthorizeUser(aCircuit, out reason))
+ {
+ // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
+ return false;
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message);
+ return false;
+ }
+
if (position == Vector3.Zero) // Teleport
{
if (!RegionInfo.EstateSettings.AllowDirectTeleport)
@@ -5530,6 +5590,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
+
+ float posX = 128.0f;
+ float posY = 128.0f;
+
+ if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
+ {
+ // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
+ return false;
+ }
+ }
+ else // Walking
+ {
+ ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
+ if (land == null)
+ return false;
+
+ bool banned = land.IsBannedFromLand(agentID);
+ bool restricted = land.IsRestrictedFromLand(agentID);
+
+ if (banned || restricted)
+ return false;
}
reason = String.Empty;
--
cgit v1.1
From 304c5d4a8b8a1137bac18f7f6443ea85cec86184 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 3 May 2013 18:48:50 +0100
Subject: On startup, start scenes after we're set up all local scenes, rather
than starting scenes before others have been created.
This aims to avoid a race condition where scenes could look to inform neighbours that they were up before those neighbours had been created.
http://opensimulator.org/mantis/view.php?id=6618
---
OpenSim/Region/Framework/Scenes/Scene.cs | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 829a7e9..4f674a3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -389,10 +389,12 @@ namespace OpenSim.Region.Framework.Scenes
if (value)
{
if (!m_active)
- Start();
+ Start(false);
}
else
{
+ // This appears assymetric with Start() above but is not - setting m_active = false stops the loops
+ // XXX: Possibly this should be in an explicit Stop() method for symmetry.
m_active = false;
}
}
@@ -1331,10 +1333,18 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public override void Start()
+ {
+ Start(true);
+ }
+
///
/// Start the scene
///
- public void Start()
+ ///
+ /// Start the scripts within the scene.
+ ///
+ public void Start(bool startScripts)
{
m_active = true;
@@ -1353,6 +1363,8 @@ namespace OpenSim.Region.Framework.Scenes
m_heartbeatThread
= Watchdog.StartThread(
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
+
+ StartScripts();
}
///
--
cgit v1.1