* Enables logins to regions on a grid once they have finished starting up (this does not include script startup).

0.6.0-stable
Justin Clarke Casey 2008-09-19 20:02:19 +00:00
parent 858d8416b4
commit e518fe5d34
2 changed files with 47 additions and 30 deletions

View File

@ -425,7 +425,7 @@ namespace OpenSim
LoadPlugins(); LoadPlugins();
// Only enable logins to the regions once we have completely finished starting up // Only enable logins to the regions once we have completely finished starting up (apart from scripts)
m_commsManager.GridService.RegionLoginsEnabled = true; m_commsManager.GridService.RegionLoginsEnabled = true;
} }

View File

@ -613,7 +613,7 @@ namespace OpenSim.Region.Communications.OGS1
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
public XmlRpcResponse ExpectUser(XmlRpcRequest request) public XmlRpcResponse ExpectUser(XmlRpcRequest request)
{ {
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
AgentCircuitData agentData = new AgentCircuitData(); AgentCircuitData agentData = new AgentCircuitData();
agentData.SessionID = new UUID((string) requestData["session_id"]); agentData.SessionID = new UUID((string) requestData["session_id"]);
@ -627,7 +627,7 @@ namespace OpenSim.Region.Communications.OGS1
m_log.DebugFormat( m_log.DebugFormat(
"[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}", "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}",
agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode); agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode);
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
{ {
@ -644,45 +644,62 @@ namespace OpenSim.Region.Communications.OGS1
agentData.child = false; agentData.child = false;
} }
RegionInfo[] regions = m_regionsOnInstance.ToArray();
bool banned = false;
for (int i = 0; i < regions.Length; i++)
{
if (regions[i] != null)
{
if (regions[i].RegionHandle == regionHandle)
{
if (regions[i].EstateSettings.IsBanned(agentData.AgentID))
{
banned = true;
break;
}
}
}
}
XmlRpcResponse resp = new XmlRpcResponse(); XmlRpcResponse resp = new XmlRpcResponse();
if (banned) if (!m_regionLoginsEnabled)
{ {
m_log.InfoFormat("[CLIENT]: Denying access for user {0} {1} because user is banned",agentData.firstname,agentData.lastname); m_log.InfoFormat(
"[CLIENT]: Denying access for user {0} {1} because region login is currently disabled",
agentData.firstname, agentData.lastname);
Hashtable respdata = new Hashtable(); Hashtable respdata = new Hashtable();
respdata["success"] = "FALSE"; respdata["success"] = "FALSE";
respdata["reason"] = "banned"; respdata["reason"] = "region login currently disabled";
resp.Value = respdata; resp.Value = respdata;
} }
else else
{ {
m_localBackend.TriggerExpectUser(regionHandle, agentData); RegionInfo[] regions = m_regionsOnInstance.ToArray();
Hashtable respdata = new Hashtable(); bool banned = false;
respdata["success"] = "TRUE";
resp.Value = respdata; for (int i = 0; i < regions.Length; i++)
{
if (regions[i] != null)
{
if (regions[i].RegionHandle == regionHandle)
{
if (regions[i].EstateSettings.IsBanned(agentData.AgentID))
{
banned = true;
break;
}
}
}
}
if (banned)
{
m_log.InfoFormat(
"[CLIENT]: Denying access for user {0} {1} because user is banned",
agentData.firstname, agentData.lastname);
Hashtable respdata = new Hashtable();
respdata["success"] = "FALSE";
respdata["reason"] = "banned";
resp.Value = respdata;
}
else
{
m_localBackend.TriggerExpectUser(regionHandle, agentData);
Hashtable respdata = new Hashtable();
respdata["success"] = "TRUE";
resp.Value = respdata;
}
} }
return resp; return resp;
} }
// Grid Request Processing // Grid Request Processing
/// <summary> /// <summary>
/// Ooops, our Agent must be dead if we're getting this request! /// Ooops, our Agent must be dead if we're getting this request!