diff options
author | Melanie | 2011-01-28 03:07:25 +0100 |
---|---|---|
committer | Melanie | 2011-01-28 03:07:25 +0100 |
commit | 657c14c5db8b0c882484926ba76aa64ec757ee07 (patch) | |
tree | 595a97b1a82144acade004772d65e018ca93426c | |
parent | Comment a very spammy debug message that was being output directly to console. (diff) | |
download | opensim-SC-657c14c5db8b0c882484926ba76aa64ec757ee07.zip opensim-SC-657c14c5db8b0c882484926ba76aa64ec757ee07.tar.gz opensim-SC-657c14c5db8b0c882484926ba76aa64ec757ee07.tar.bz2 opensim-SC-657c14c5db8b0c882484926ba76aa64ec757ee07.tar.xz |
Fix up QueryAccess to also check parcels
Diffstat (limited to '')
7 files changed, 46 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 016871f..9e1d414 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
285 | return; | 285 | return; |
286 | } | 286 | } |
287 | 287 | ||
288 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId)) | 288 | if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero)) |
289 | { | 289 | { |
290 | sp.ControllingClient.SendTeleportFailed("The destination region has refused access"); | 290 | sp.ControllingClient.SendTeleportFailed("The destination region has refused access"); |
291 | return; | 291 | return; |
@@ -797,8 +797,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
797 | 797 | ||
798 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 798 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
799 | 799 | ||
800 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId)) | 800 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos)) |
801 | { | 801 | { |
802 | agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); | ||
802 | if (r == null) | 803 | if (r == null) |
803 | { | 804 | { |
804 | r = new ExpiringCache<ulong, DateTime>(); | 805 | r = new ExpiringCache<ulong, DateTime>(); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index aaf7bf3..971a56f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -257,7 +257,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
257 | return false; | 257 | return false; |
258 | } | 258 | } |
259 | 259 | ||
260 | public bool QueryAccess(GridRegion destination, UUID id) | 260 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) |
261 | { | 261 | { |
262 | if (destination == null) | 262 | if (destination == null) |
263 | return false; | 263 | return false; |
@@ -265,7 +265,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
265 | foreach (Scene s in m_sceneList) | 265 | foreach (Scene s in m_sceneList) |
266 | { | 266 | { |
267 | if (s.RegionInfo.RegionID == destination.RegionID) | 267 | if (s.RegionInfo.RegionID == destination.RegionID) |
268 | return s.QueryAccess(id); | 268 | return s.QueryAccess(id, position); |
269 | } | 269 | } |
270 | return false; | 270 | return false; |
271 | } | 271 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 27792c8..e8a6629 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -239,18 +239,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
239 | 239 | ||
240 | } | 240 | } |
241 | 241 | ||
242 | public bool QueryAccess(GridRegion destination, UUID id) | 242 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) |
243 | { | 243 | { |
244 | if (destination == null) | 244 | if (destination == null) |
245 | return false; | 245 | return false; |
246 | 246 | ||
247 | // Try local first | 247 | // Try local first |
248 | if (m_localBackend.QueryAccess(destination, id)) | 248 | if (m_localBackend.QueryAccess(destination, id, position)) |
249 | return true; | 249 | return true; |
250 | 250 | ||
251 | // else do the remote thing | 251 | // else do the remote thing |
252 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | 252 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) |
253 | return m_remoteConnector.QueryAccess(destination, id); | 253 | return m_remoteConnector.QueryAccess(destination, id, position); |
254 | 254 | ||
255 | return false; | 255 | return false; |
256 | 256 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5caf06c..c65a82b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -5141,23 +5141,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
5141 | // from logging into the region, teleporting into the region | 5141 | // from logging into the region, teleporting into the region |
5142 | // or corssing the broder walking, but will NOT prevent | 5142 | // or corssing the broder walking, but will NOT prevent |
5143 | // child agent creation, thereby emulating the SL behavior. | 5143 | // child agent creation, thereby emulating the SL behavior. |
5144 | public bool QueryAccess(UUID agentID) | 5144 | public bool QueryAccess(UUID agentID, Vector3 position) |
5145 | { | 5145 | { |
5146 | string reason; | 5146 | string reason; |
5147 | 5147 | ||
5148 | if (!AuthorizeUser(agentID, out reason)) | 5148 | if (!AuthorizeUser(agentID, out reason)) |
5149 | { | 5149 | { |
5150 | m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | 5150 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); |
5151 | return false; | 5151 | return false; |
5152 | } | 5152 | } |
5153 | 5153 | ||
5154 | float posX = 128.0f; | 5154 | if (position == Vector3.Zero) // Teleport |
5155 | float posY = 128.0f; | 5155 | { |
5156 | float posX = 128.0f; | ||
5157 | float posY = 128.0f; | ||
5156 | 5158 | ||
5157 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | 5159 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) |
5160 | { | ||
5161 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5162 | return false; | ||
5163 | } | ||
5164 | } | ||
5165 | else // Walking | ||
5158 | { | 5166 | { |
5159 | m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | 5167 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); |
5160 | return false; | 5168 | if (land == null) |
5169 | return false; | ||
5170 | |||
5171 | bool banned = land.IsBannedFromLand(agentID); | ||
5172 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5173 | |||
5174 | if (banned || restricted) | ||
5175 | return false; | ||
5161 | } | 5176 | } |
5162 | return true; | 5177 | return true; |
5163 | } | 5178 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 89832f4..b33b0d5 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -331,10 +331,17 @@ namespace OpenSim.Server.Handlers.Simulation | |||
331 | return; | 331 | return; |
332 | } | 332 | } |
333 | 333 | ||
334 | // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); | ||
335 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | ||
336 | |||
337 | Vector3 position = Vector3.Zero; | ||
338 | if (args.ContainsKey("position")) | ||
339 | position = Vector3.Parse(args["position"].AsString()); | ||
340 | |||
334 | GridRegion destination = new GridRegion(); | 341 | GridRegion destination = new GridRegion(); |
335 | destination.RegionID = regionID; | 342 | destination.RegionID = regionID; |
336 | 343 | ||
337 | bool result = m_SimulationService.QueryAccess(destination, id); | 344 | bool result = m_SimulationService.QueryAccess(destination, id, position); |
338 | 345 | ||
339 | responsedata["int_response_code"] = HttpStatusCode.OK; | 346 | responsedata["int_response_code"] = HttpStatusCode.OK; |
340 | responsedata["str_response_string"] = result.ToString(); | 347 | responsedata["str_response_string"] = result.ToString(); |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 039d9e5..752d552 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -31,6 +31,7 @@ using System.IO; | |||
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Collections; | ||
34 | 35 | ||
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
@@ -206,9 +207,9 @@ namespace OpenSim.Services.Connectors.Simulation | |||
206 | 207 | ||
207 | /// <summary> | 208 | /// <summary> |
208 | /// </summary> | 209 | /// </summary> |
209 | public bool QueryAccess(GridRegion destination, UUID id) | 210 | public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) |
210 | { | 211 | { |
211 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start"); | 212 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); |
212 | 213 | ||
213 | IPEndPoint ext = destination.ExternalEndPoint; | 214 | IPEndPoint ext = destination.ExternalEndPoint; |
214 | if (ext == null) return false; | 215 | if (ext == null) return false; |
@@ -216,9 +217,12 @@ namespace OpenSim.Services.Connectors.Simulation | |||
216 | // Eventually, we want to use a caps url instead of the agentID | 217 | // Eventually, we want to use a caps url instead of the agentID |
217 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | 218 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; |
218 | 219 | ||
220 | OSDMap request = new OSDMap(); | ||
221 | request.Add("position", OSD.FromString(position.ToString())); | ||
222 | |||
219 | try | 223 | try |
220 | { | 224 | { |
221 | OSDMap result = WebUtil.ServiceOSDRequest(uri,null,"QUERYACCESS",10000); | 225 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); |
222 | return result["Success"].AsBoolean(); | 226 | return result["Success"].AsBoolean(); |
223 | } | 227 | } |
224 | catch (Exception e) | 228 | catch (Exception e) |
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 1f8474c..f08e1c0 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Services.Interfaces | |||
60 | 60 | ||
61 | bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); | 61 | bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); |
62 | 62 | ||
63 | bool QueryAccess(GridRegion destination, UUID id); | 63 | bool QueryAccess(GridRegion destination, UUID id, Vector3 position); |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// Message from receiving region to departing region, telling it got contacted by the client. | 66 | /// Message from receiving region to departing region, telling it got contacted by the client. |