diff options
author | Teravus Ovares (Dan Olivares) | 2010-05-15 23:22:07 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2010-05-15 23:22:07 -0400 |
commit | 019925bb2f87695cd16d1bebff4ef300b16e67f1 (patch) | |
tree | b596598ebde44e1bd69c64898f4236d515303871 /OpenSim/Region | |
parent | * Add User Friendly Configuration File Exists check. If OpenSim.ini and eith... (diff) | |
parent | Almost, but not quite. Commenting verification again, until I understand wher... (diff) | |
download | opensim-SC_OLD-019925bb2f87695cd16d1bebff4ef300b16e67f1.zip opensim-SC_OLD-019925bb2f87695cd16d1bebff4ef300b16e67f1.tar.gz opensim-SC_OLD-019925bb2f87695cd16d1bebff4ef300b16e67f1.tar.bz2 opensim-SC_OLD-019925bb2f87695cd16d1bebff4ef300b16e67f1.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
4 files changed, 78 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index 2a1355b..a6f5d97 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs | |||
@@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities | |||
107 | } | 107 | } |
108 | 108 | ||
109 | Caps caps | 109 | Caps caps |
110 | = new Caps( | 110 | = new Caps(m_scene, |
111 | m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, | 111 | m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, |
112 | MainServer.Instance.Port, | 112 | MainServer.Instance.Port, |
113 | capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); | 113 | capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index edbef4c..401551d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2629,34 +2629,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2629 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2629 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2630 | 2630 | ||
2631 | // Do the verification here | 2631 | // Do the verification here |
2632 | System.Net.EndPoint ep = client.GetClientEP(); | 2632 | System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); |
2633 | if (aCircuit != null) | 2633 | if (aCircuit != null) |
2634 | { | 2634 | { |
2635 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | 2635 | if (!VerifyClient(aCircuit, ep, out vialogin)) |
2636 | { | 2636 | { |
2637 | m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 2637 | // uh-oh, this is fishy |
2638 | vialogin = true; | 2638 | m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", |
2639 | IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); | 2639 | client.AgentId, client.SessionId, ep.ToString()); |
2640 | if (userVerification != null && ep != null) | 2640 | try |
2641 | { | 2641 | { |
2642 | if (!userVerification.VerifyClient(aCircuit, ep.ToString())) | 2642 | client.Close(); |
2643 | { | 2643 | } |
2644 | // uh-oh, this is fishy | 2644 | catch (Exception e) |
2645 | m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", | 2645 | { |
2646 | client.AgentId, client.SessionId, ep.ToString()); | 2646 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); |
2647 | try | ||
2648 | { | ||
2649 | client.Close(); | ||
2650 | } | ||
2651 | catch (Exception e) | ||
2652 | { | ||
2653 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); | ||
2654 | } | ||
2655 | return; | ||
2656 | } | ||
2657 | else | ||
2658 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} returned true", aCircuit.firstname, aCircuit.lastname); | ||
2659 | } | 2647 | } |
2648 | return; | ||
2660 | } | 2649 | } |
2661 | } | 2650 | } |
2662 | 2651 | ||
@@ -2682,7 +2671,65 @@ namespace OpenSim.Region.Framework.Scenes | |||
2682 | EventManager.TriggerOnClientLogin(client); | 2671 | EventManager.TriggerOnClientLogin(client); |
2683 | } | 2672 | } |
2684 | 2673 | ||
2685 | 2674 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) | |
2675 | { | ||
2676 | vialogin = false; | ||
2677 | |||
2678 | // Do the verification here | ||
2679 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | ||
2680 | { | ||
2681 | m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2682 | vialogin = true; | ||
2683 | IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); | ||
2684 | if (userVerification != null && ep != null) | ||
2685 | { | ||
2686 | if (!userVerification.VerifyClient(aCircuit, ep.Address.ToString())) | ||
2687 | { | ||
2688 | // uh-oh, this is fishy | ||
2689 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2690 | return false; | ||
2691 | } | ||
2692 | else | ||
2693 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2694 | } | ||
2695 | } | ||
2696 | |||
2697 | return true; | ||
2698 | } | ||
2699 | |||
2700 | // Called by Caps, on the first HTTP contact from the client | ||
2701 | public override bool CheckClient(UUID agentID, System.Net.IPEndPoint ep) | ||
2702 | { | ||
2703 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(agentID); | ||
2704 | if (aCircuit != null) | ||
2705 | { | ||
2706 | bool vialogin = false; | ||
2707 | if (!VerifyClient(aCircuit, ep, out vialogin)) | ||
2708 | { | ||
2709 | // if it doesn't pass, we remove the agentcircuitdata altogether | ||
2710 | // and the scene presence and the client, if they exist | ||
2711 | try | ||
2712 | { | ||
2713 | ScenePresence sp = GetScenePresence(agentID); | ||
2714 | if (sp != null) | ||
2715 | sp.ControllingClient.Close(); | ||
2716 | |||
2717 | // BANG! SLASH! | ||
2718 | m_authenticateHandler.RemoveCircuit(agentID); | ||
2719 | |||
2720 | return false; | ||
2721 | } | ||
2722 | catch (Exception e) | ||
2723 | { | ||
2724 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); | ||
2725 | } | ||
2726 | } | ||
2727 | else | ||
2728 | return true; | ||
2729 | } | ||
2730 | |||
2731 | return false; | ||
2732 | } | ||
2686 | 2733 | ||
2687 | /// <summary> | 2734 | /// <summary> |
2688 | /// Register for events from the client | 2735 | /// Register for events from the client |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 3218dad..bfc19b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -536,5 +536,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
536 | get { return false; } | 536 | get { return false; } |
537 | } | 537 | } |
538 | 538 | ||
539 | public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); | ||
539 | } | 540 | } |
540 | } | 541 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs index dd9f8f6..42587c1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs | |||
@@ -70,6 +70,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
70 | { | 70 | { |
71 | throw new NotImplementedException(); | 71 | throw new NotImplementedException(); |
72 | } | 72 | } |
73 | |||
74 | public override bool CheckClient(UUID agentID, System.Net.IPEndPoint ep) | ||
75 | { | ||
76 | throw new NotImplementedException(); | ||
77 | } | ||
73 | } | 78 | } |
74 | 79 | ||
75 | [Test] | 80 | [Test] |