diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 87 |
1 files changed, 42 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 455e163..9b2b8c7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2637,18 +2637,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2637 | /// <param name="client"></param> | 2637 | /// <param name="client"></param> |
2638 | public override void AddNewClient(IClientAPI client) | 2638 | public override void AddNewClient(IClientAPI client) |
2639 | { | 2639 | { |
2640 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | ||
2640 | bool vialogin = false; | 2641 | bool vialogin = false; |
2641 | 2642 | ||
2642 | m_clientManager.Add(client); | 2643 | if (aCircuit == null) // no good, didn't pass NewUserConnection successfully |
2644 | return; | ||
2645 | |||
2646 | vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || | ||
2647 | (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | ||
2643 | 2648 | ||
2644 | CheckHeartbeat(); | 2649 | CheckHeartbeat(); |
2645 | SubscribeToClientEvents(client); | ||
2646 | ScenePresence presence; | 2650 | ScenePresence presence; |
2647 | 2651 | ||
2648 | if (m_restorePresences.ContainsKey(client.AgentId)) | 2652 | if (m_restorePresences.ContainsKey(client.AgentId)) |
2649 | { | 2653 | { |
2650 | m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); | 2654 | m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); |
2651 | 2655 | ||
2656 | m_clientManager.Add(client); | ||
2657 | SubscribeToClientEvents(client); | ||
2658 | |||
2652 | presence = m_restorePresences[client.AgentId]; | 2659 | presence = m_restorePresences[client.AgentId]; |
2653 | m_restorePresences.Remove(client.AgentId); | 2660 | m_restorePresences.Remove(client.AgentId); |
2654 | 2661 | ||
@@ -2671,49 +2678,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
2671 | } | 2678 | } |
2672 | else | 2679 | else |
2673 | { | 2680 | { |
2674 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2681 | if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here |
2675 | 2682 | { | |
2676 | //// Do the verification here -- No, really don't do this here. This is UDP address, let it go. | 2683 | m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); |
2677 | //System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); | ||
2678 | //if (aCircuit != null) | ||
2679 | //{ | ||
2680 | // if (!VerifyClient(aCircuit, ep, out vialogin)) | ||
2681 | // { | ||
2682 | // // uh-oh, this is fishy | ||
2683 | // m_log.WarnFormat("[SCENE]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", | ||
2684 | // client.AgentId, client.SessionId, ep.ToString()); | ||
2685 | // try | ||
2686 | // { | ||
2687 | // client.Close(); | ||
2688 | // } | ||
2689 | // catch (Exception e) | ||
2690 | // { | ||
2691 | // m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace); | ||
2692 | // } | ||
2693 | // return; | ||
2694 | // } | ||
2695 | //} | ||
2696 | 2684 | ||
2697 | m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); | 2685 | m_clientManager.Add(client); |
2686 | SubscribeToClientEvents(client); | ||
2698 | 2687 | ||
2699 | ScenePresence sp = CreateAndAddScenePresence(client); | 2688 | ScenePresence sp = CreateAndAddScenePresence(client); |
2700 | if (aCircuit != null) | 2689 | if (aCircuit != null) |
2701 | sp.Appearance = aCircuit.Appearance; | 2690 | sp.Appearance = aCircuit.Appearance; |
2702 | 2691 | ||
2703 | // HERE!!! Do the initial attachments right here | 2692 | // HERE!!! Do the initial attachments right here |
2704 | // first agent upon login is a root agent by design. | 2693 | // first agent upon login is a root agent by design. |
2705 | // All other AddNewClient calls find aCircuit.child to be true | 2694 | // All other AddNewClient calls find aCircuit.child to be true |
2706 | if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) | 2695 | if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) |
2707 | { | 2696 | { |
2708 | sp.IsChildAgent = false; | 2697 | sp.IsChildAgent = false; |
2709 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); | 2698 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); |
2699 | } | ||
2710 | } | 2700 | } |
2711 | } | 2701 | } |
2712 | 2702 | ||
2713 | m_LastLogin = Util.EnvironmentTickCount(); | 2703 | if (GetScenePresence(client.AgentId) != null) |
2714 | EventManager.TriggerOnNewClient(client); | 2704 | { |
2715 | if (vialogin) | 2705 | m_LastLogin = Util.EnvironmentTickCount(); |
2716 | EventManager.TriggerOnClientLogin(client); | 2706 | EventManager.TriggerOnNewClient(client); |
2707 | if (vialogin) | ||
2708 | EventManager.TriggerOnClientLogin(client); | ||
2709 | } | ||
2717 | } | 2710 | } |
2718 | 2711 | ||
2719 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) | 2712 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) |
@@ -2740,8 +2733,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2740 | } | 2733 | } |
2741 | 2734 | ||
2742 | else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | 2735 | else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) |
2743 | m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.", | 2736 | { |
2737 | m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.", | ||
2744 | aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 2738 | aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); |
2739 | vialogin = true; | ||
2740 | } | ||
2745 | 2741 | ||
2746 | return true; | 2742 | return true; |
2747 | } | 2743 | } |
@@ -3437,7 +3433,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3437 | /// also return a reason.</returns> | 3433 | /// also return a reason.</returns> |
3438 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) | 3434 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) |
3439 | { | 3435 | { |
3440 | TeleportFlags tp = (TeleportFlags)teleportFlags; | 3436 | bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || |
3437 | (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); | ||
3441 | reason = String.Empty; | 3438 | reason = String.Empty; |
3442 | 3439 | ||
3443 | //Teleport flags: | 3440 | //Teleport flags: |
@@ -3474,7 +3471,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3474 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 3471 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
3475 | 3472 | ||
3476 | //On login test land permisions | 3473 | //On login test land permisions |
3477 | if (tp == TeleportFlags.ViaLogin) | 3474 | if (vialogin) |
3478 | { | 3475 | { |
3479 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3476 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3480 | { | 3477 | { |
@@ -3533,7 +3530,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3533 | agent.teleportFlags = teleportFlags; | 3530 | agent.teleportFlags = teleportFlags; |
3534 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3531 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3535 | 3532 | ||
3536 | if (tp == TeleportFlags.ViaLogin) | 3533 | if (vialogin) |
3537 | { | 3534 | { |
3538 | if (TestBorderCross(agent.startpos, Cardinals.E)) | 3535 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3539 | { | 3536 | { |
@@ -3651,7 +3648,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3651 | IPresenceService presence = RequestModuleInterface<IPresenceService>(); | 3648 | IPresenceService presence = RequestModuleInterface<IPresenceService>(); |
3652 | if (presence == null) | 3649 | if (presence == null) |
3653 | { | 3650 | { |
3654 | reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName); | 3651 | reason = String.Format("Failed to verify user presence in the grid for {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName); |
3655 | return false; | 3652 | return false; |
3656 | } | 3653 | } |
3657 | 3654 | ||
@@ -3659,7 +3656,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3659 | 3656 | ||
3660 | if (pinfo == null) | 3657 | if (pinfo == null) |
3661 | { | 3658 | { |
3662 | reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName); | 3659 | reason = String.Format("Failed to verify user presence in the grid for {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName); |
3663 | return false; | 3660 | return false; |
3664 | } | 3661 | } |
3665 | 3662 | ||