mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
- moving banned check and public/private check to
Scene.NewUserConnection() - adding reason reporting this enforces estate bans very early on and prevents us from circulating client objects that we'd then have to retract once we realize that the client is not allowed into the region
This commit is contained in:
@@ -43,7 +43,7 @@ namespace OpenSim.Framework.Communications.Clients
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey)
|
||||
public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey, out string reason)
|
||||
{
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/";
|
||||
@@ -56,6 +56,8 @@ namespace OpenSim.Framework.Communications.Clients
|
||||
//AgentCreateRequest.KeepAlive = false;
|
||||
AgentCreateRequest.Headers.Add("Authorization", authKey);
|
||||
|
||||
reason = String.Empty;
|
||||
|
||||
// Fill it in
|
||||
OSDMap args = null;
|
||||
try
|
||||
@@ -98,7 +100,7 @@ namespace OpenSim.Framework.Communications.Clients
|
||||
catch
|
||||
{
|
||||
//m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message);
|
||||
|
||||
reason = "cannot contact remote region";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,13 +114,24 @@ namespace OpenSim.Framework.Communications.Clients
|
||||
{
|
||||
m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
|
||||
//reply = sr.ReadToEnd().Trim();
|
||||
sr.ReadToEnd().Trim();
|
||||
sr.Close();
|
||||
//m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply);
|
||||
|
||||
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
|
||||
string response = sr.ReadToEnd().Trim();
|
||||
sr.Close();
|
||||
m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", response);
|
||||
|
||||
if (!String.IsNullOrEmpty(response))
|
||||
{
|
||||
// we assume we got an OSDMap back
|
||||
OSDMap r = GetOSDMap(response);
|
||||
bool success = r["success"].AsBoolean();
|
||||
reason = r["reason"].AsString();
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace OpenSim.Framework.Communications.Services
|
||||
{
|
||||
return GenerateFailureResponseLLSD(
|
||||
"key",
|
||||
"Error connecting to grid. Could not percieve credentials from login XML.",
|
||||
"Error connecting to grid. Could not perceive credentials from login XML.",
|
||||
"false");
|
||||
}
|
||||
|
||||
|
||||
@@ -946,13 +946,15 @@ namespace OpenSim.Framework.Communications.Services
|
||||
{
|
||||
regionInfo = homeInfo;
|
||||
theUser.CurrentAgent.Position = theUser.HomeLocation;
|
||||
response.LookAt = "[r" + theUser.HomeLookAt.X.ToString() + ",r" + theUser.HomeLookAt.Y.ToString() + ",r" + theUser.HomeLookAt.Z.ToString() + "]";
|
||||
response.LookAt = String.Format("[r{0},r{1},r{2}]", theUser.HomeLookAt.X.ToString(),
|
||||
theUser.HomeLookAt.Y.ToString(), theUser.HomeLookAt.Z.ToString());
|
||||
}
|
||||
else if (startLocationRequest == "last")
|
||||
{
|
||||
UUID lastRegion = theUser.CurrentAgent.Region;
|
||||
regionInfo = GetRegionInfo(lastRegion);
|
||||
response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
|
||||
response.LookAt = String.Format("[r{0},r{1},r{2}]", theUser.CurrentAgent.LookAt.X.ToString(),
|
||||
theUser.CurrentAgent.LookAt.Y.ToString(), theUser.CurrentAgent.LookAt.Z.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -345,8 +345,9 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
{
|
||||
}
|
||||
|
||||
public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent)
|
||||
public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason)
|
||||
{
|
||||
reason = String.Empty;
|
||||
lock (m_regionsList)
|
||||
{
|
||||
foreach (RegionInfo regInfo in m_regionsList)
|
||||
@@ -355,6 +356,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||
return true;
|
||||
}
|
||||
}
|
||||
reason = "Region not found";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenSim.Framework
|
||||
{
|
||||
bool RegionLoginsEnabled { get; }
|
||||
void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message);
|
||||
bool NewUserConnection(ulong regionHandle, AgentCircuitData agent);
|
||||
bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason);
|
||||
RegionInfo RequestClosestRegion(string region);
|
||||
RegionInfo RequestNeighbourInfo(UUID regionID);
|
||||
RegionInfo RequestNeighbourInfo(ulong regionhandle);
|
||||
|
||||
Reference in New Issue
Block a user