Fix up QueryAccess to also check parcels

viewer-2-initial-appearance
Melanie 2011-01-28 04:09:04 +00:00
parent d90b0c53ec
commit 188d86998d
7 changed files with 31 additions and 16 deletions

View File

@ -284,6 +284,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; return;
} }
if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero))
{
sp.ControllingClient.SendTeleportFailed("The destination region has refused access");
return;
}
sp.ControllingClient.SendTeleportStart(teleportFlags); sp.ControllingClient.SendTeleportStart(teleportFlags);
// the avatar.Close below will clear the child region list. We need this below for (possibly) // the avatar.Close below will clear the child region list. We need this below for (possibly)
@ -772,8 +778,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId)) if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos))
{ {
agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
if (r == null) if (r == null)
{ {
r = new ExpiringCache<ulong, DateTime>(); r = new ExpiringCache<ulong, DateTime>();

View File

@ -257,18 +257,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false; return false;
} }
public bool QueryAccess(GridRegion destination, UUID id) public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
{ {
if (destination == null) if (destination == null)
return false; return false;
foreach (Scene s in m_sceneList) foreach (Scene s in m_sceneList)
{ {
if (s.RegionInfo.RegionHandle == destination.RegionHandle) if (s.RegionInfo.RegionID == destination.RegionID)
{ return s.QueryAccess(id, position);
//m_log.Debug("[LOCAL COMMS]: Found region to send QueryAccess");
return s.QueryAccess(id);
}
} }
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
return false; return false;

View File

@ -239,18 +239,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
} }
public bool QueryAccess(GridRegion destination, UUID id) public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
{ {
if (destination == null) if (destination == null)
return false; return false;
// Try local first // Try local first
if (m_localBackend.QueryAccess(destination, id)) if (m_localBackend.QueryAccess(destination, id, position))
return true; return true;
// else do the remote thing // else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
return m_remoteConnector.QueryAccess(destination, id); return m_remoteConnector.QueryAccess(destination, id, position);
return false; return false;

View File

@ -4921,7 +4921,7 @@ namespace OpenSim.Region.Framework.Scenes
// from logging into the region, teleporting into the region // from logging into the region, teleporting into the region
// or corssing the broder walking, but will NOT prevent // or corssing the broder walking, but will NOT prevent
// child agent creation, thereby emulating the SL behavior. // child agent creation, thereby emulating the SL behavior.
public bool QueryAccess(UUID agentID) public bool QueryAccess(UUID agentID, Vector3 position)
{ {
return true; return true;
} }

View File

@ -326,10 +326,17 @@ namespace OpenSim.Server.Handlers.Simulation
return; return;
} }
// m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
OSDMap args = Utils.GetOSDMap((string)request["body"]);
Vector3 position = Vector3.Zero;
if (args.ContainsKey("position"))
position = Vector3.Parse(args["position"].AsString());
GridRegion destination = new GridRegion(); GridRegion destination = new GridRegion();
destination.RegionID = regionID; destination.RegionID = regionID;
bool result = m_SimulationService.QueryAccess(destination, id); bool result = m_SimulationService.QueryAccess(destination, id, position);
responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["int_response_code"] = HttpStatusCode.OK;
responsedata["str_response_string"] = result.ToString(); responsedata["str_response_string"] = result.ToString();

View File

@ -31,6 +31,7 @@ using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Collections;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
@ -206,9 +207,9 @@ namespace OpenSim.Services.Connectors.Simulation
/// <summary> /// <summary>
/// </summary> /// </summary>
public bool QueryAccess(GridRegion destination, UUID id) public bool QueryAccess(GridRegion destination, UUID id, Vector3 position)
{ {
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start"); // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
IPEndPoint ext = destination.ExternalEndPoint; IPEndPoint ext = destination.ExternalEndPoint;
if (ext == null) return false; if (ext == null) return false;
@ -216,9 +217,12 @@ namespace OpenSim.Services.Connectors.Simulation
// Eventually, we want to use a caps url instead of the agentID // Eventually, we want to use a caps url instead of the agentID
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
OSDMap request = new OSDMap();
request.Add("position", OSD.FromString(position.ToString()));
try try
{ {
OSDMap result = WebUtil.ServiceOSDRequest(uri,null,"QUERYACCESS",10000); OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000);
return result["Success"].AsBoolean(); return result["Success"].AsBoolean();
} }
catch (Exception e) catch (Exception e)

View File

@ -60,7 +60,7 @@ namespace OpenSim.Services.Interfaces
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
bool QueryAccess(GridRegion destination, UUID id); bool QueryAccess(GridRegion destination, UUID id, Vector3 position);
/// <summary> /// <summary>
/// Message from receiving region to departing region, telling it got contacted by the client. /// Message from receiving region to departing region, telling it got contacted by the client.