add more of the v03 checks and homeURL. Sending side only for now
parent
73124f22cc
commit
ce883e9b43
|
@ -750,9 +750,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
string version;
|
string version;
|
||||||
string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
|
string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
|
||||||
if (!Scene.SimulationService.QueryAccess(
|
if (!Scene.SimulationService.QueryAccess(
|
||||||
finalDestination, sp.ControllingClient.AgentId, position, out version, out reason))
|
finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason))
|
||||||
// if (!Scene.SimulationService.QueryAccess(
|
|
||||||
// finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason))
|
|
||||||
{
|
{
|
||||||
sp.ControllingClient.SendTeleportFailed(reason);
|
sp.ControllingClient.SendTeleportFailed(reason);
|
||||||
|
|
||||||
|
@ -1470,8 +1468,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene ascene = agent.Scene;
|
Scene ascene = agent.Scene;
|
||||||
|
string homeURI = ascene.GetAgentHomeURI(agentID);
|
||||||
|
string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
|
||||||
|
|
||||||
if (!ascene.SimulationService.QueryAccess(destiny, agentID, position, out version, out reason))
|
|
||||||
|
if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position,
|
||||||
|
myversion, out version, out reason))
|
||||||
{
|
{
|
||||||
m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0);
|
m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1490,6 +1492,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// see that it is actually outside the current region), find the new region that the
|
// see that it is actually outside the current region), find the new region that the
|
||||||
// point is actually in.
|
// point is actually in.
|
||||||
// Returns the coordinates and information of the new region or 'null' of it doesn't exist.
|
// Returns the coordinates and information of the new region or 'null' of it doesn't exist.
|
||||||
|
|
||||||
|
// now only works for crossings
|
||||||
|
|
||||||
public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
|
public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
|
||||||
out string version, out Vector3 newpos, out string failureReason)
|
out string version, out Vector3 newpos, out string failureReason)
|
||||||
{
|
{
|
||||||
|
@ -1529,8 +1534,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
// Check to see if we have access to the target region.
|
// Check to see if we have access to the target region.
|
||||||
string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
|
string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
|
||||||
|
string homeURI = scene.GetAgentHomeURI(agentID);
|
||||||
if (neighbourRegion != null
|
if (neighbourRegion != null
|
||||||
&& !scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out failureReason))
|
&& !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, out version, out failureReason))
|
||||||
{
|
{
|
||||||
// remember banned
|
// remember banned
|
||||||
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
|
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
|
||||||
|
@ -1581,7 +1587,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
agent.IsInTransit = false;
|
agent.IsInTransit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ScenePresence CrossAsync(ScenePresence agent, bool isFlying)
|
public ScenePresence CrossAsync(ScenePresence agent, bool isFlying)
|
||||||
{
|
{
|
||||||
uint x;
|
uint x;
|
||||||
|
|
|
@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
|
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason)
|
||||||
{
|
{
|
||||||
reason = "Communications failure";
|
reason = "Communications failure";
|
||||||
version = ServiceVersion;
|
version = ServiceVersion;
|
||||||
|
@ -277,7 +277,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||||
// s.RegionInfo.RegionName, destination.RegionHandle);
|
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||||
|
|
||||||
return m_scenes[destination.RegionID].QueryAccess(id, position, out reason);
|
|
||||||
|
// not really need on a grid running var regions sims
|
||||||
|
|
||||||
|
uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX;
|
||||||
|
|
||||||
|
float theirVersionNumber = 0f;
|
||||||
|
string[] versionComponents = theirversion.Split(new char[] { '/' });
|
||||||
|
if (versionComponents.Length >= 2)
|
||||||
|
float.TryParse(versionComponents[1], out theirVersionNumber);
|
||||||
|
|
||||||
|
// Var regions here, and the requesting simulator is in an older version.
|
||||||
|
// We will forbide this, because it crashes the viewers
|
||||||
|
if (theirVersionNumber < 0.3f && size > 256)
|
||||||
|
{
|
||||||
|
reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading.";
|
||||||
|
m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_scenes[destination.RegionID].QueryAccess(agentID, position, out reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
|
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
|
||||||
|
|
|
@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
return m_remoteConnector.UpdateAgent(destination, cAgentData);
|
return m_remoteConnector.UpdateAgent(destination, cAgentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
|
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason)
|
||||||
{
|
{
|
||||||
reason = "Communications failure";
|
reason = "Communications failure";
|
||||||
version = "Unknown";
|
version = "Unknown";
|
||||||
|
@ -216,12 +216,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Try local first
|
// Try local first
|
||||||
if (m_localBackend.QueryAccess(destination, id, position, out version, out reason))
|
if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason))
|
||||||
|
return true;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// else do the remote thing
|
// else do the remote thing
|
||||||
if (!m_localBackend.IsLocalRegion(destination.RegionID))
|
if (!m_localBackend.IsLocalRegion(destination.RegionID))
|
||||||
return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason);
|
return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason);
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
|
protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID)
|
||||||
{
|
{
|
||||||
if (m_SimulationService == null)
|
if (m_SimulationService == null)
|
||||||
{
|
{
|
||||||
|
@ -132,16 +132,28 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
// m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
|
// m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
|
||||||
OSDMap args = Utils.GetOSDMap((string)request["body"]);
|
OSDMap args = Utils.GetOSDMap((string)request["body"]);
|
||||||
|
|
||||||
|
bool viaTeleport = true;
|
||||||
|
if (args.ContainsKey("viaTeleport"))
|
||||||
|
viaTeleport = args["viaTeleport"].AsBoolean();
|
||||||
|
|
||||||
Vector3 position = Vector3.Zero;
|
Vector3 position = Vector3.Zero;
|
||||||
if (args.ContainsKey("position"))
|
if (args.ContainsKey("position"))
|
||||||
position = Vector3.Parse(args["position"].AsString());
|
position = Vector3.Parse(args["position"].AsString());
|
||||||
|
|
||||||
|
string agentHomeURI = null;
|
||||||
|
if (args.ContainsKey("agent_home_uri"))
|
||||||
|
agentHomeURI = args["agent_home_uri"].AsString();
|
||||||
|
|
||||||
|
string theirVersion = string.Empty;
|
||||||
|
if (args.ContainsKey("my_version"))
|
||||||
|
theirVersion = args["my_version"].AsString();
|
||||||
|
|
||||||
GridRegion destination = new GridRegion();
|
GridRegion destination = new GridRegion();
|
||||||
destination.RegionID = regionID;
|
destination.RegionID = regionID;
|
||||||
|
|
||||||
string reason;
|
string reason;
|
||||||
string version;
|
string version;
|
||||||
bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason);
|
bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason);
|
||||||
|
|
||||||
responsedata["int_response_code"] = HttpStatusCode.OK;
|
responsedata["int_response_code"] = HttpStatusCode.OK;
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
|
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason)
|
||||||
{
|
{
|
||||||
reason = "Failed to contact destination";
|
reason = "Failed to contact destination";
|
||||||
version = "Unknown";
|
version = "Unknown";
|
||||||
|
@ -286,10 +286,14 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
if (ext == null) return false;
|
if (ext == null) return false;
|
||||||
|
|
||||||
// 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() + agentID + "/" + destination.RegionID.ToString() + "/";
|
||||||
|
|
||||||
OSDMap request = new OSDMap();
|
OSDMap request = new OSDMap();
|
||||||
|
request.Add("viaTeleport", OSD.FromBoolean(viaTeleport));
|
||||||
request.Add("position", OSD.FromString(position.ToString()));
|
request.Add("position", OSD.FromString(position.ToString()));
|
||||||
|
request.Add("my_version", OSD.FromString(myversion));
|
||||||
|
if (agentHomeURI != null)
|
||||||
|
request.Add("agent_home_uri", OSD.FromString(agentHomeURI));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,19 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool UpdateAgent(GridRegion destination, AgentPosition data);
|
bool UpdateAgent(GridRegion destination, AgentPosition data);
|
||||||
|
|
||||||
bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason);
|
/// <summary>
|
||||||
|
/// Returns whether a propspective user is allowed to visit the region.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="destination">Desired destination</param>
|
||||||
|
/// <param name="agentID">The visitor's User ID</param>
|
||||||
|
/// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param>
|
||||||
|
/// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param>
|
||||||
|
/// <param name="position">Position in the region</param>
|
||||||
|
/// <param name="sversion">version that the requesting simulator is runing</param>
|
||||||
|
/// <param name="version">version that the target simulator is running</param>
|
||||||
|
/// <param name="reason">[out] Optional error message</param>
|
||||||
|
/// <returns>True: ok; False: not allowed</returns>
|
||||||
|
bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason);
|
||||||
|
|
||||||
/// <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.
|
||||||
|
|
Loading…
Reference in New Issue