From dd30a29ba07a181d5c8f5773140a7247a0066510 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Sun, 18 May 2014 16:10:18 +0300
Subject: Return more specific error messages if an attempt to enter a region
fails due to permissions (in QueryAccess and IsAuthorizedForRegion)
---
OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++++++++--
1 file changed, 13 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 e6887b4..1115399 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3865,7 +3865,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!AuthorizationService.IsAuthorizedForRegion(
agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
{
- m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}",
+ m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
return false;
@@ -5465,7 +5465,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason)
{
- reason = "You are banned from the region";
+ reason = string.Empty;
if (Permissions.IsGod(agentID))
{
@@ -5525,6 +5525,7 @@ namespace OpenSim.Region.Framework.Scenes
catch (Exception e)
{
m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message);
+ reason = "Error authorizing agent: " + e.Message;
return false;
}
@@ -5568,6 +5569,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
{
// m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
+ reason = "You are banned from the region on all parcels";
return false;
}
}
@@ -5575,13 +5577,22 @@ namespace OpenSim.Region.Framework.Scenes
{
ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
if (land == null)
+ {
+ reason = "No parcel found";
return false;
+ }
bool banned = land.IsBannedFromLand(agentID);
bool restricted = land.IsRestrictedFromLand(agentID);
if (banned || restricted)
+ {
+ if (banned)
+ reason = "You are banned from the parcel";
+ else
+ reason = "The parcel is restricted";
return false;
+ }
}
reason = String.Empty;
--
cgit v1.1
From 47b84875fd2b9f01140288a2695c33f5ef4466c0 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Sun, 18 May 2014 19:45:27 +0300
Subject: Tell QueryAccess explicitly whether the user is coming in via
Teleport or Cross, because the permission checks are different.
Previously we used a heuristic of checking if the entry position is 0 to differentiate between Teleport and Cross, but that doesn't work anymore since we've started providing the precise entry position for cross, too. That's required in order to ensure that the user is allowed to enter the parcel that he's walking into.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++--
1 file changed, 2 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 1115399..3b8fbfd 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5463,7 +5463,7 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason)
+ public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason)
{
reason = string.Empty;
@@ -5529,7 +5529,7 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
- if (position == Vector3.Zero) // Teleport
+ if (viaTeleport)
{
if (!RegionInfo.EstateSettings.AllowDirectTeleport)
{
--
cgit v1.1