aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs61
1 files changed, 52 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e6887b4..eff24f8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3751,6 +3751,13 @@ namespace OpenSim.Region.Framework.Scenes
3751 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); 3751 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
3752 } 3752 }
3753 3753
3754 // Final permissions check; this time we don't allow changing the position
3755 if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason))
3756 {
3757 m_authenticateHandler.RemoveCircuit(acd.circuitcode);
3758 return false;
3759 }
3760
3754 return true; 3761 return true;
3755 } 3762 }
3756 3763
@@ -3760,6 +3767,13 @@ namespace OpenSim.Region.Framework.Scenes
3760 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3767 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
3761 { 3768 {
3762 acd.startpos = land.LandData.UserLocation; 3769 acd.startpos = land.LandData.UserLocation;
3770
3771 // Final permissions check; this time we don't allow changing the position
3772 if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason))
3773 {
3774 m_authenticateHandler.RemoveCircuit(acd.circuitcode);
3775 return false;
3776 }
3763 } 3777 }
3764 } 3778 }
3765 } 3779 }
@@ -3767,6 +3781,21 @@ namespace OpenSim.Region.Framework.Scenes
3767 return true; 3781 return true;
3768 } 3782 }
3769 3783
3784 private bool IsPositionAllowed(UUID agentID, Vector3 pos, ref string reason)
3785 {
3786 ILandObject land = LandChannel.GetLandObject(pos);
3787 if (land == null)
3788 return true;
3789
3790 if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID))
3791 {
3792 reason = "You are banned from the region.";
3793 return false;
3794 }
3795
3796 return true;
3797 }
3798
3770 public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) 3799 public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
3771 { 3800 {
3772 if (posX < 0) 3801 if (posX < 0)
@@ -3865,7 +3894,7 @@ namespace OpenSim.Region.Framework.Scenes
3865 if (!AuthorizationService.IsAuthorizedForRegion( 3894 if (!AuthorizationService.IsAuthorizedForRegion(
3866 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) 3895 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
3867 { 3896 {
3868 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}", 3897 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}",
3869 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); 3898 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
3870 3899
3871 return false; 3900 return false;
@@ -4133,7 +4162,10 @@ namespace OpenSim.Region.Framework.Scenes
4133 /// <returns>true if we handled it.</returns> 4162 /// <returns>true if we handled it.</returns>
4134 public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) 4163 public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData)
4135 { 4164 {
4136 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); 4165// m_log.DebugFormat(
4166// "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}",
4167// cAgentData.AgentID, Name, cAgentData.Position);
4168
4137 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 4169 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
4138 if (childAgentUpdate != null) 4170 if (childAgentUpdate != null)
4139 { 4171 {
@@ -5150,7 +5182,7 @@ namespace OpenSim.Region.Framework.Scenes
5150 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 5182 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
5151 if (nearestPoint != null) 5183 if (nearestPoint != null)
5152 { 5184 {
5153 Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); 5185 m_log.Debug("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString());
5154 return nearestPoint.Value; 5186 return nearestPoint.Value;
5155 } 5187 }
5156 5188
@@ -5160,7 +5192,7 @@ namespace OpenSim.Region.Framework.Scenes
5160 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 5192 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
5161 if (nearestPoint != null) 5193 if (nearestPoint != null)
5162 { 5194 {
5163 Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); 5195 m_log.Debug("They had a zero velocity, sending them to: " + nearestPoint.ToString());
5164 return nearestPoint.Value; 5196 return nearestPoint.Value;
5165 } 5197 }
5166 5198
@@ -5169,7 +5201,7 @@ namespace OpenSim.Region.Framework.Scenes
5169 { 5201 {
5170 // Ultimate backup if we have no idea where they are and 5202 // Ultimate backup if we have no idea where they are and
5171 // the last allowed position was in another parcel 5203 // the last allowed position was in another parcel
5172 Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); 5204 m_log.Debug("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
5173 return avatar.lastKnownAllowedPosition; 5205 return avatar.lastKnownAllowedPosition;
5174 } 5206 }
5175 5207
@@ -5179,7 +5211,7 @@ namespace OpenSim.Region.Framework.Scenes
5179 //Go to the edge, this happens in teleporting to a region with no available parcels 5211 //Go to the edge, this happens in teleporting to a region with no available parcels
5180 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); 5212 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
5181 5213
5182 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); 5214 //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
5183 5215
5184 return nearestRegionEdgePoint; 5216 return nearestRegionEdgePoint;
5185 } 5217 }
@@ -5463,9 +5495,9 @@ namespace OpenSim.Region.Framework.Scenes
5463 /// <param name='position'></param> 5495 /// <param name='position'></param>
5464 /// <param name='reason'></param> 5496 /// <param name='reason'></param>
5465 /// <returns></returns> 5497 /// <returns></returns>
5466 public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason) 5498 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason)
5467 { 5499 {
5468 reason = "You are banned from the region"; 5500 reason = string.Empty;
5469 5501
5470 if (Permissions.IsGod(agentID)) 5502 if (Permissions.IsGod(agentID))
5471 { 5503 {
@@ -5525,10 +5557,11 @@ namespace OpenSim.Region.Framework.Scenes
5525 catch (Exception e) 5557 catch (Exception e)
5526 { 5558 {
5527 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); 5559 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message);
5560 reason = "Error authorizing agent: " + e.Message;
5528 return false; 5561 return false;
5529 } 5562 }
5530 5563
5531 if (position == Vector3.Zero) // Teleport 5564 if (viaTeleport)
5532 { 5565 {
5533 if (!RegionInfo.EstateSettings.AllowDirectTeleport) 5566 if (!RegionInfo.EstateSettings.AllowDirectTeleport)
5534 { 5567 {
@@ -5568,6 +5601,7 @@ namespace OpenSim.Region.Framework.Scenes
5568 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) 5601 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
5569 { 5602 {
5570 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); 5603 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
5604 reason = "You are banned from the region on all parcels";
5571 return false; 5605 return false;
5572 } 5606 }
5573 } 5607 }
@@ -5575,13 +5609,22 @@ namespace OpenSim.Region.Framework.Scenes
5575 { 5609 {
5576 ILandObject land = LandChannel.GetLandObject(position.X, position.Y); 5610 ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
5577 if (land == null) 5611 if (land == null)
5612 {
5613 reason = "No parcel found";
5578 return false; 5614 return false;
5615 }
5579 5616
5580 bool banned = land.IsBannedFromLand(agentID); 5617 bool banned = land.IsBannedFromLand(agentID);
5581 bool restricted = land.IsRestrictedFromLand(agentID); 5618 bool restricted = land.IsRestrictedFromLand(agentID);
5582 5619
5583 if (banned || restricted) 5620 if (banned || restricted)
5621 {
5622 if (banned)
5623 reason = "You are banned from the parcel";
5624 else
5625 reason = "The parcel is restricted";
5584 return false; 5626 return false;
5627 }
5585 } 5628 }
5586 5629
5587 reason = String.Empty; 5630 reason = String.Empty;