When sending QueryAccess to a region, also send the user's Home URI

0.8.0.3
Oren Hurvitz 2014-04-07 09:25:18 +03:00
parent 55cc8044cb
commit 85d51e57a9
8 changed files with 47 additions and 16 deletions

View File

@ -700,6 +700,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2} to {3} ({4}) {5}/{6}",
sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName,
@ -744,7 +746,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string reason;
string version;
if (!Scene.SimulationService.QueryAccess(
finalDestination, sp.ControllingClient.AgentId, position, out version, out reason))
finalDestination, sp.ControllingClient.AgentId, homeURI, position, out version, out reason))
{
sp.ControllingClient.SendTeleportFailed(reason);
@ -1456,6 +1458,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
version = String.Empty;
newpos = pos;
failureReason = string.Empty;
string homeURI = scene.GetAgentHomeURI(agentID);
// m_log.DebugFormat(
// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
@ -1489,7 +1492,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Check to see if we have access to the target region.
if (neighbourRegion != null
&& !scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out failureReason))
&& !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, newpos, out version, out failureReason))
{
// remember banned
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);

View File

@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
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, Vector3 position, out string version, out string reason)
{
reason = "Communications failure";
version = ServiceVersion;
@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
return m_scenes[destination.RegionID].QueryAccess(id, position, out reason);
return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, position, out reason);
}
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");

View File

@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
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, Vector3 position, out string version, out string reason)
{
reason = "Communications failure";
version = "Unknown";
@ -216,12 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false;
// Try local first
if (m_localBackend.QueryAccess(destination, id, position, out version, out reason))
if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason))
return true;
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionID))
return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason);
return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason);
return false;
}

View File

@ -5466,11 +5466,12 @@ namespace OpenSim.Region.Framework.Scenes
/// or corssing the broder walking, but will NOT prevent
/// child agent creation, thereby emulating the SL behavior.
/// </remarks>
/// <param name='agentID'></param>
/// <param name='agentID'>The visitor's User ID</param>
/// <param name="agentHomeURI">The visitor's Home URI (may be null)</param>
/// <param name='position'></param>
/// <param name='reason'></param>
/// <returns></returns>
public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason)
{
reason = "You are banned from the region";

View File

@ -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)
{
@ -136,12 +136,16 @@ namespace OpenSim.Server.Handlers.Simulation
if (args.ContainsKey("position"))
position = Vector3.Parse(args["position"].AsString());
string agentHomeURI = null;
if (args.ContainsKey("agent_home_uri"))
agentHomeURI = args["agent_home_uri"].AsString();
GridRegion destination = new GridRegion();
destination.RegionID = regionID;
string reason;
string version;
bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason);
bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason);
responsedata["int_response_code"] = HttpStatusCode.OK;

View File

@ -272,9 +272,7 @@ namespace OpenSim.Services.Connectors.Simulation
}
/// <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, Vector3 position, out string version, out string reason)
{
reason = "Failed to contact destination";
version = "Unknown";
@ -285,10 +283,12 @@ namespace OpenSim.Services.Connectors.Simulation
if (ext == null) return false;
// 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();
request.Add("position", OSD.FromString(position.ToString()));
if (agentHomeURI != null)
request.Add("agent_home_uri", OSD.FromString(agentHomeURI));
try
{

View File

@ -37,6 +37,19 @@ namespace OpenSim.Services.Interfaces
public interface IGatekeeperService
{
bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason);
/// <summary>
/// Returns the region a Hypergrid visitor should enter.
/// </summary>
/// <remarks>
/// Usually the returned region will be the requested region. But the grid can choose to
/// redirect the user to another region: e.g., a default gateway region.
/// </remarks>
/// <param name="regionID">The region the visitor *wants* to enter</param>
/// <param name="agentID">The visitor's User ID. Will be missing (UUID.Zero) in older OpenSims.</param>
/// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param>
/// <param name="message">[out] A message to show to the user (optional, may be null)</param>
/// <returns>The region the visitor should enter, or null if no region can be found / is allowed</returns>
GridRegion GetHyperlinkRegion(UUID regionID, UUID agentID, string agentHomeURI, out string message);
bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason);

View File

@ -75,7 +75,17 @@ namespace OpenSim.Services.Interfaces
/// <returns></returns>
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="position">Position in the region</param>
/// <param name="version"></param>
/// <param name="reason">[out] Optional error message</param>
/// <returns>True: ok; False: not allowed</returns>
bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, Vector3 position, out string version, out string reason);
/// <summary>
/// Message from receiving region to departing region, telling it got contacted by the client.