Minor reordering of operations on NewUserConnection. The agent circuit needs to be added earlier for some of the checks to work correctly.

user_profiles
Diva Canto 2013-05-06 09:17:54 -07:00
parent a517e597f5
commit ad00466483
1 changed files with 17 additions and 5 deletions

View File

@ -3687,14 +3687,21 @@ namespace OpenSim.Region.Framework.Scenes
sp.ControllingClient.Close(true); sp.ControllingClient.Close(true);
sp = null; sp = null;
} }
// Optimistic: add or update the circuit data with the new agent circuit data and teleport flags.
// We need the circuit data here for some of the subsequent checks. (groups, for example)
// If the checks fail, we remove the circuit.
agent.teleportFlags = teleportFlags;
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
//On login test land permisions // On login test land permisions
if (vialogin) if (vialogin)
{ {
if (land != null && !TestLandRestrictions(agent, land, out reason)) if (land != null && !TestLandRestrictions(agent, land, out reason))
{ {
m_authenticateHandler.RemoveCircuit(agent.circuitcode);
return false; return false;
} }
} }
@ -3706,13 +3713,17 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
if (!VerifyUserPresence(agent, out reason)) if (!VerifyUserPresence(agent, out reason))
{
m_authenticateHandler.RemoveCircuit(agent.circuitcode);
return false; return false;
}
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace);
m_authenticateHandler.RemoveCircuit(agent.circuitcode);
return false; return false;
} }
} }
@ -3720,13 +3731,17 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
if (!AuthorizeUser(agent, out reason)) if (!AuthorizeUser(agent, out reason))
{
m_authenticateHandler.RemoveCircuit(agent.circuitcode);
return false; return false;
}
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace);
m_authenticateHandler.RemoveCircuit(agent.circuitcode);
return false; return false;
} }
@ -3761,9 +3776,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
// In all cases, add or update the circuit data with the new agent circuit data and teleport flags
agent.teleportFlags = teleportFlags;
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
if (vialogin) if (vialogin)
{ {