aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2013-04-29 00:55:34 +0100
committerMelanie2013-04-29 00:55:34 +0100
commit3ff7391495271fed152aadc7a588ae976e09bafc (patch)
tree3f04bd0df9fa22048065009e72b2bfb65765e39e /OpenSim/Region/Framework
parentFix wrong sql statement in offline im. (diff)
downloadopensim-SC_OLD-3ff7391495271fed152aadc7a588ae976e09bafc.zip
opensim-SC_OLD-3ff7391495271fed152aadc7a588ae976e09bafc.tar.gz
opensim-SC_OLD-3ff7391495271fed152aadc7a588ae976e09bafc.tar.bz2
opensim-SC_OLD-3ff7391495271fed152aadc7a588ae976e09bafc.tar.xz
Some more pieces of Avination's ban system - if an avatar isn't allowed on any
parcel in the sim, keep them out entirely.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs95
1 files changed, 88 insertions, 7 deletions
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
3693 //On login test land permisions 3693 //On login test land permisions
3694 if (vialogin) 3694 if (vialogin)
3695 { 3695 {
3696 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3696 if (land != null && !TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y))
3697 { 3697 {
3698 return false; 3698 return false;
3699 } 3699 }
@@ -3868,20 +3868,37 @@ namespace OpenSim.Region.Framework.Scenes
3868 return true; 3868 return true;
3869 } 3869 }
3870 3870
3871 private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) 3871 public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
3872 { 3872 {
3873 bool banned = land.IsBannedFromLand(agent.AgentID); 3873 if (posX < 0)
3874 bool restricted = land.IsRestrictedFromLand(agent.AgentID); 3874 posX = 0;
3875 else if (posX >= 256)
3876 posX = 255.999f;
3877 if (posY < 0)
3878 posY = 0;
3879 else if (posY >= 256)
3880 posY = 255.999f;
3881
3882 reason = String.Empty;
3883 if (Permissions.IsGod(agentID))
3884 return true;
3885
3886 ILandObject land = LandChannel.GetLandObject(posX, posY);
3887 if (land == null)
3888 return false;
3889
3890 bool banned = land.IsBannedFromLand(agentID);
3891 bool restricted = land.IsRestrictedFromLand(agentID);
3875 3892
3876 if (banned || restricted) 3893 if (banned || restricted)
3877 { 3894 {
3878 ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); 3895 ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY);
3879 if (nearestParcel != null) 3896 if (nearestParcel != null)
3880 { 3897 {
3881 //Move agent to nearest allowed 3898 //Move agent to nearest allowed
3882 Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); 3899 Vector3 newPosition = GetParcelCenterAtGround(nearestParcel);
3883 agent.startpos.X = newPosition.X; 3900 posX = newPosition.X;
3884 agent.startpos.Y = newPosition.Y; 3901 posY = newPosition.Y;
3885 } 3902 }
3886 else 3903 else
3887 { 3904 {
@@ -5466,6 +5483,8 @@ namespace OpenSim.Region.Framework.Scenes
5466 /// <returns></returns> 5483 /// <returns></returns>
5467 public bool QueryAccess(UUID agentID, Vector3 position, out string reason) 5484 public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
5468 { 5485 {
5486 reason = "You are banned from the region";
5487
5469 if (EntityTransferModule.IsInTransit(agentID)) 5488 if (EntityTransferModule.IsInTransit(agentID))
5470 { 5489 {
5471 reason = "Agent is still in transit from this region"; 5490 reason = "Agent is still in transit from this region";
@@ -5477,6 +5496,12 @@ namespace OpenSim.Region.Framework.Scenes
5477 return false; 5496 return false;
5478 } 5497 }
5479 5498
5499 if (Permissions.IsGod(agentID))
5500 {
5501 reason = String.Empty;
5502 return true;
5503 }
5504
5480 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. 5505 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
5481 // However, the long term fix is to make sure root agent count is always accurate. 5506 // However, the long term fix is to make sure root agent count is always accurate.
5482 m_sceneGraph.RecalculateStats(); 5507 m_sceneGraph.RecalculateStats();
@@ -5497,6 +5522,41 @@ namespace OpenSim.Region.Framework.Scenes
5497 } 5522 }
5498 } 5523 }
5499 5524
5525 ScenePresence presence = GetScenePresence(agentID);
5526 IClientAPI client = null;
5527 AgentCircuitData aCircuit = null;
5528
5529 if (presence != null)
5530 {
5531 client = presence.ControllingClient;
5532 if (client != null)
5533 aCircuit = client.RequestClientInfo();
5534 }
5535
5536 // We may be called before there is a presence or a client.
5537 // Fake AgentCircuitData to keep IAuthorizationModule smiling
5538 if (client == null)
5539 {
5540 aCircuit = new AgentCircuitData();
5541 aCircuit.AgentID = agentID;
5542 aCircuit.firstname = String.Empty;
5543 aCircuit.lastname = String.Empty;
5544 }
5545
5546 try
5547 {
5548 if (!AuthorizeUser(aCircuit, out reason))
5549 {
5550 // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
5551 return false;
5552 }
5553 }
5554 catch (Exception e)
5555 {
5556 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message);
5557 return false;
5558 }
5559
5500 if (position == Vector3.Zero) // Teleport 5560 if (position == Vector3.Zero) // Teleport
5501 { 5561 {
5502 if (!RegionInfo.EstateSettings.AllowDirectTeleport) 5562 if (!RegionInfo.EstateSettings.AllowDirectTeleport)
@@ -5530,6 +5590,27 @@ namespace OpenSim.Region.Framework.Scenes
5530 } 5590 }
5531 } 5591 }
5532 } 5592 }
5593
5594 float posX = 128.0f;
5595 float posY = 128.0f;
5596
5597 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
5598 {
5599 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
5600 return false;
5601 }
5602 }
5603 else // Walking
5604 {
5605 ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
5606 if (land == null)
5607 return false;
5608
5609 bool banned = land.IsBannedFromLand(agentID);
5610 bool restricted = land.IsRestrictedFromLand(agentID);
5611
5612 if (banned || restricted)
5613 return false;
5533 } 5614 }
5534 5615
5535 reason = String.Empty; 5616 reason = String.Empty;