- 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:
Dr Scofield
2009-05-05 16:17:52 +00:00
parent b6ae8b7ba7
commit e0a06f6416
19 changed files with 186 additions and 131 deletions

View File

@@ -160,8 +160,9 @@ namespace OpenSim.Region.CoreModules.Hypergrid
}
}
public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent)
public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason)
{
reason = String.Empty;
return true;
}

View File

@@ -545,7 +545,15 @@ namespace OpenSim.Region.CoreModules.InterGrid
homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(userProfile);
// Call 'new user' event handler
homeScene.NewUserConnection(agentData);
string reason;
if (!homeScene.NewUserConnection(agentData, out reason))
{
responseMap["connect"] = OSD.FromBoolean(false);
responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason));
m_log.ErrorFormat("[OGP]: rez_avatar/request failed: {0}", reason);
return responseMap;
}
//string raCap = string.Empty;

View File

@@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
@@ -112,19 +113,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
* Agent-related communications
*/
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit)
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
{
foreach (Scene s in m_sceneList)
{
if (s.RegionInfo.RegionHandle == regionHandle)
{
// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle);
s.NewUserConnection(aCircuit);
return true;
return s.NewUserConnection(aCircuit, out reason);
}
}
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle);
reason = "Did not find region.";
return false;
}

View File

@@ -140,10 +140,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
* Agent-related communications
*/
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit)
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
{
// Try local first
if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit))
if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, out reason))
return true;
// else do the remote thing
@@ -154,7 +154,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
{
m_regionClient.SendUserInformation(regInfo, aCircuit);
return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None");
return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", out reason);
}
//else
// m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
@@ -431,12 +431,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
return;
}
OSDMap resp = new OSDMap(2);
string reason = String.Empty;
// This is the meaning of POST agent
m_regionClient.AdjustUserInformation(aCircuit);
bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit);
bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, out reason);
resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result);
// TODO: add reason if not String.Empty?
responsedata["int_response_code"] = 200;
responsedata["str_response_string"] = result.ToString();
responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
}
protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata)