From ad00466483c0bcdb5d05759130f35870c6a7a177 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 6 May 2013 09:17:54 -0700 Subject: [PATCH] Minor reordering of operations on NewUserConnection. The agent circuit needs to be added earlier for some of the checks to work correctly. --- OpenSim/Region/Framework/Scenes/Scene.cs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 69fe137bcb..ff7e5edba1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3687,14 +3687,21 @@ namespace OpenSim.Region.Framework.Scenes sp.ControllingClient.Close(true); 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); - //On login test land permisions + // On login test land permisions if (vialogin) { if (land != null && !TestLandRestrictions(agent, land, out reason)) { + m_authenticateHandler.RemoveCircuit(agent.circuitcode); return false; } } @@ -3706,13 +3713,17 @@ namespace OpenSim.Region.Framework.Scenes try { if (!VerifyUserPresence(agent, out reason)) + { + m_authenticateHandler.RemoveCircuit(agent.circuitcode); return false; + } } catch (Exception e) { m_log.ErrorFormat( "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); + m_authenticateHandler.RemoveCircuit(agent.circuitcode); return false; } } @@ -3720,13 +3731,17 @@ namespace OpenSim.Region.Framework.Scenes try { if (!AuthorizeUser(agent, out reason)) + { + m_authenticateHandler.RemoveCircuit(agent.circuitcode); return false; + } } catch (Exception e) { m_log.ErrorFormat( "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); + m_authenticateHandler.RemoveCircuit(agent.circuitcode); 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) {