aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs111
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs4
2 files changed, 106 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ff7e5ed..8fe2d72 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -389,10 +389,12 @@ namespace OpenSim.Region.Framework.Scenes
389 if (value) 389 if (value)
390 { 390 {
391 if (!m_active) 391 if (!m_active)
392 Start(); 392 Start(false);
393 } 393 }
394 else 394 else
395 { 395 {
396 // This appears assymetric with Start() above but is not - setting m_active = false stops the loops
397 // XXX: Possibly this should be in an explicit Stop() method for symmetry.
396 m_active = false; 398 m_active = false;
397 } 399 }
398 } 400 }
@@ -1331,10 +1333,18 @@ namespace OpenSim.Region.Framework.Scenes
1331 } 1333 }
1332 } 1334 }
1333 1335
1336 public override void Start()
1337 {
1338 Start(true);
1339 }
1340
1334 /// <summary> 1341 /// <summary>
1335 /// Start the scene 1342 /// Start the scene
1336 /// </summary> 1343 /// </summary>
1337 public void Start() 1344 /// <param name='startScripts'>
1345 /// Start the scripts within the scene.
1346 /// </param>
1347 public void Start(bool startScripts)
1338 { 1348 {
1339 m_active = true; 1349 m_active = true;
1340 1350
@@ -1353,6 +1363,8 @@ namespace OpenSim.Region.Framework.Scenes
1353 m_heartbeatThread 1363 m_heartbeatThread
1354 = Watchdog.StartThread( 1364 = Watchdog.StartThread(
1355 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); 1365 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
1366
1367 StartScripts();
1356 } 1368 }
1357 1369
1358 /// <summary> 1370 /// <summary>
@@ -3699,7 +3711,7 @@ namespace OpenSim.Region.Framework.Scenes
3699 // On login test land permisions 3711 // On login test land permisions
3700 if (vialogin) 3712 if (vialogin)
3701 { 3713 {
3702 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3714 if (land != null && !TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y))
3703 { 3715 {
3704 m_authenticateHandler.RemoveCircuit(agent.circuitcode); 3716 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3705 return false; 3717 return false;
@@ -3880,20 +3892,37 @@ namespace OpenSim.Region.Framework.Scenes
3880 return true; 3892 return true;
3881 } 3893 }
3882 3894
3883 private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) 3895 public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
3884 { 3896 {
3885 bool banned = land.IsBannedFromLand(agent.AgentID); 3897 if (posX < 0)
3886 bool restricted = land.IsRestrictedFromLand(agent.AgentID); 3898 posX = 0;
3899 else if (posX >= 256)
3900 posX = 255.999f;
3901 if (posY < 0)
3902 posY = 0;
3903 else if (posY >= 256)
3904 posY = 255.999f;
3905
3906 reason = String.Empty;
3907 if (Permissions.IsGod(agentID))
3908 return true;
3909
3910 ILandObject land = LandChannel.GetLandObject(posX, posY);
3911 if (land == null)
3912 return false;
3913
3914 bool banned = land.IsBannedFromLand(agentID);
3915 bool restricted = land.IsRestrictedFromLand(agentID);
3887 3916
3888 if (banned || restricted) 3917 if (banned || restricted)
3889 { 3918 {
3890 ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); 3919 ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY);
3891 if (nearestParcel != null) 3920 if (nearestParcel != null)
3892 { 3921 {
3893 //Move agent to nearest allowed 3922 //Move agent to nearest allowed
3894 Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); 3923 Vector3 newPosition = GetParcelCenterAtGround(nearestParcel);
3895 agent.startpos.X = newPosition.X; 3924 posX = newPosition.X;
3896 agent.startpos.Y = newPosition.Y; 3925 posY = newPosition.Y;
3897 } 3926 }
3898 else 3927 else
3899 { 3928 {
@@ -5478,6 +5507,8 @@ namespace OpenSim.Region.Framework.Scenes
5478 /// <returns></returns> 5507 /// <returns></returns>
5479 public bool QueryAccess(UUID agentID, Vector3 position, out string reason) 5508 public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
5480 { 5509 {
5510 reason = "You are banned from the region";
5511
5481 if (EntityTransferModule.IsInTransit(agentID)) 5512 if (EntityTransferModule.IsInTransit(agentID))
5482 { 5513 {
5483 reason = "Agent is still in transit from this region"; 5514 reason = "Agent is still in transit from this region";
@@ -5489,6 +5520,12 @@ namespace OpenSim.Region.Framework.Scenes
5489 return false; 5520 return false;
5490 } 5521 }
5491 5522
5523 if (Permissions.IsGod(agentID))
5524 {
5525 reason = String.Empty;
5526 return true;
5527 }
5528
5492 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. 5529 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
5493 // However, the long term fix is to make sure root agent count is always accurate. 5530 // However, the long term fix is to make sure root agent count is always accurate.
5494 m_sceneGraph.RecalculateStats(); 5531 m_sceneGraph.RecalculateStats();
@@ -5509,6 +5546,41 @@ namespace OpenSim.Region.Framework.Scenes
5509 } 5546 }
5510 } 5547 }
5511 5548
5549 ScenePresence presence = GetScenePresence(agentID);
5550 IClientAPI client = null;
5551 AgentCircuitData aCircuit = null;
5552
5553 if (presence != null)
5554 {
5555 client = presence.ControllingClient;
5556 if (client != null)
5557 aCircuit = client.RequestClientInfo();
5558 }
5559
5560 // We may be called before there is a presence or a client.
5561 // Fake AgentCircuitData to keep IAuthorizationModule smiling
5562 if (client == null)
5563 {
5564 aCircuit = new AgentCircuitData();
5565 aCircuit.AgentID = agentID;
5566 aCircuit.firstname = String.Empty;
5567 aCircuit.lastname = String.Empty;
5568 }
5569
5570 try
5571 {
5572 if (!AuthorizeUser(aCircuit, out reason))
5573 {
5574 // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
5575 return false;
5576 }
5577 }
5578 catch (Exception e)
5579 {
5580 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message);
5581 return false;
5582 }
5583
5512 if (position == Vector3.Zero) // Teleport 5584 if (position == Vector3.Zero) // Teleport
5513 { 5585 {
5514 if (!RegionInfo.EstateSettings.AllowDirectTeleport) 5586 if (!RegionInfo.EstateSettings.AllowDirectTeleport)
@@ -5542,6 +5614,27 @@ namespace OpenSim.Region.Framework.Scenes
5542 } 5614 }
5543 } 5615 }
5544 } 5616 }
5617
5618 float posX = 128.0f;
5619 float posY = 128.0f;
5620
5621 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
5622 {
5623 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
5624 return false;
5625 }
5626 }
5627 else // Walking
5628 {
5629 ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
5630 if (land == null)
5631 return false;
5632
5633 bool banned = land.IsBannedFromLand(agentID);
5634 bool restricted = land.IsRestrictedFromLand(agentID);
5635
5636 if (banned || restricted)
5637 return false;
5545 } 5638 }
5546 5639
5547 reason = String.Empty; 5640 reason = String.Empty;
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index d3e968e..d2097ea 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -561,6 +561,10 @@ namespace OpenSim.Region.Framework.Scenes
561 get { return false; } 561 get { return false; }
562 } 562 }
563 563
564 public virtual void Start()
565 {
566 }
567
564 public void Restart() 568 public void Restart()
565 { 569 {
566 // This has to be here to fire the event 570 // This has to be here to fire the event