aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorOren Hurvitz2014-05-18 16:10:18 +0300
committerOren Hurvitz2014-05-19 11:11:30 +0100
commitdd30a29ba07a181d5c8f5773140a7247a0066510 (patch)
treec5e2844ce29947dabd7944a8551c35afc5d1c359 /OpenSim
parentBetter error-handling and logging in case User Profile requests fail (diff)
downloadopensim-SC-dd30a29ba07a181d5c8f5773140a7247a0066510.zip
opensim-SC-dd30a29ba07a181d5c8f5773140a7247a0066510.tar.gz
opensim-SC-dd30a29ba07a181d5c8f5773140a7247a0066510.tar.bz2
opensim-SC-dd30a29ba07a181d5c8f5773140a7247a0066510.tar.xz
Return more specific error messages if an attempt to enter a region fails due to permissions (in QueryAccess and IsAuthorizedForRegion)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs34
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs15
-rw-r--r--OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs2
4 files changed, 36 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 539367d..3830791 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -766,7 +766,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
766 sp.ControllingClient.SendTeleportFailed(reason); 766 sp.ControllingClient.SendTeleportFailed(reason);
767 767
768 m_log.DebugFormat( 768 m_log.DebugFormat(
769 "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", 769 "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because: {3}",
770 sp.Name, sp.Scene.Name, finalDestination.RegionName, reason); 770 sp.Name, sp.Scene.Name, finalDestination.RegionName, reason);
771 771
772 return; 772 return;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs
index 4470799..93dff1f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs
@@ -89,35 +89,43 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
89 public bool IsAuthorizedForRegion( 89 public bool IsAuthorizedForRegion(
90 string user, string firstName, string lastName, string regionID, out string message) 90 string user, string firstName, string lastName, string regionID, out string message)
91 { 91 {
92 message = "authorized";
93
94 // This should not happen 92 // This should not happen
95 if (m_Scene.RegionInfo.RegionID.ToString() != regionID) 93 if (m_Scene.RegionInfo.RegionID.ToString() != regionID)
96 { 94 {
97 m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}", 95 m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}",
98 m_Scene.RegionInfo.RegionID, regionID); 96 m_Scene.RegionInfo.RegionID, regionID);
99 return true; 97 message = string.Format("Region {0} received request to authorize for region {1}", m_Scene.RegionInfo.RegionID, regionID);
98 return false;
100 } 99 }
101 100
102 if (m_accessValue == AccessFlags.None) 101 if (m_accessValue == AccessFlags.None)
102 {
103 message = "Authorized";
103 return true; 104 return true;
105 }
104 106
105 UUID userID = new UUID(user); 107 UUID userID = new UUID(user);
106 bool authorized = true; 108
107 if ((m_accessValue & AccessFlags.DisallowForeigners) == AccessFlags.DisallowForeigners) 109 if ((m_accessValue & AccessFlags.DisallowForeigners) != 0)
108 { 110 {
109 authorized = m_UserManagement.IsLocalGridUser(userID); 111 if (!m_UserManagement.IsLocalGridUser(userID))
110 if (!authorized) 112 {
111 message = "no foreigner users allowed in this region"; 113 message = "No foreign users allowed in this region";
114 return false;
115 }
112 } 116 }
113 if (authorized && (m_accessValue & AccessFlags.DisallowResidents) == AccessFlags.DisallowResidents) 117
118 if ((m_accessValue & AccessFlags.DisallowResidents) != 0)
114 { 119 {
115 authorized = m_Scene.Permissions.IsGod(userID) | m_Scene.Permissions.IsAdministrator(userID); 120 if (!(m_Scene.Permissions.IsGod(userID) || m_Scene.Permissions.IsAdministrator(userID)))
116 if (!authorized) 121 {
117 message = "only Admins and Managers allowed in this region"; 122 message = "Only Admins and Managers allowed in this region";
123 return false;
124 }
118 } 125 }
119 126
120 return authorized; 127 message = "Authorized";
128 return true;
121 } 129 }
122 130
123 } 131 }
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
3865 if (!AuthorizationService.IsAuthorizedForRegion( 3865 if (!AuthorizationService.IsAuthorizedForRegion(
3866 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) 3866 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
3867 { 3867 {
3868 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}", 3868 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); 3869 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
3870 3870
3871 return false; 3871 return false;
@@ -5465,7 +5465,7 @@ namespace OpenSim.Region.Framework.Scenes
5465 /// <returns></returns> 5465 /// <returns></returns>
5466 public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason) 5466 public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason)
5467 { 5467 {
5468 reason = "You are banned from the region"; 5468 reason = string.Empty;
5469 5469
5470 if (Permissions.IsGod(agentID)) 5470 if (Permissions.IsGod(agentID))
5471 { 5471 {
@@ -5525,6 +5525,7 @@ namespace OpenSim.Region.Framework.Scenes
5525 catch (Exception e) 5525 catch (Exception e)
5526 { 5526 {
5527 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); 5527 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message);
5528 reason = "Error authorizing agent: " + e.Message;
5528 return false; 5529 return false;
5529 } 5530 }
5530 5531
@@ -5568,6 +5569,7 @@ namespace OpenSim.Region.Framework.Scenes
5568 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) 5569 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
5569 { 5570 {
5570 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); 5571 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
5572 reason = "You are banned from the region on all parcels";
5571 return false; 5573 return false;
5572 } 5574 }
5573 } 5575 }
@@ -5575,13 +5577,22 @@ namespace OpenSim.Region.Framework.Scenes
5575 { 5577 {
5576 ILandObject land = LandChannel.GetLandObject(position.X, position.Y); 5578 ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
5577 if (land == null) 5579 if (land == null)
5580 {
5581 reason = "No parcel found";
5578 return false; 5582 return false;
5583 }
5579 5584
5580 bool banned = land.IsBannedFromLand(agentID); 5585 bool banned = land.IsBannedFromLand(agentID);
5581 bool restricted = land.IsRestrictedFromLand(agentID); 5586 bool restricted = land.IsRestrictedFromLand(agentID);
5582 5587
5583 if (banned || restricted) 5588 if (banned || restricted)
5589 {
5590 if (banned)
5591 reason = "You are banned from the parcel";
5592 else
5593 reason = "The parcel is restricted";
5584 return false; 5594 return false;
5595 }
5585 } 5596 }
5586 5597
5587 reason = String.Empty; 5598 reason = String.Empty;
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
index 35b7109..63730b3 100644
--- a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Services.Connectors
105 catch (Exception e) 105 catch (Exception e)
106 { 106 {
107 m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message); 107 m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message);
108 message = ""; 108 message = e.Message;
109 return m_ResponseOnFailure; 109 return m_ResponseOnFailure;
110 } 110 }
111 if (response == null) 111 if (response == null)