diff options
author | Melanie | 2010-05-16 15:01:56 +0100 |
---|---|---|
committer | Melanie | 2010-05-16 15:01:56 +0100 |
commit | b94cace5471c6a4269a5c2cd0969e4a106cfbdc2 (patch) | |
tree | a79d6123f0926ddf438cad2964d460ac6b58ccd5 /OpenSim/Region/Framework | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | * Fixed configs in StandaloneHypergrid.ini, it still had the SQLite connectio... (diff) | |
download | opensim-SC-b94cace5471c6a4269a5c2cd0969e4a106cfbdc2.zip opensim-SC-b94cace5471c6a4269a5c2cd0969e4a106cfbdc2.tar.gz opensim-SC-b94cace5471c6a4269a5c2cd0969e4a106cfbdc2.tar.bz2 opensim-SC-b94cace5471c6a4269a5c2cd0969e4a106cfbdc2.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 95 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneBase.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs | 5 |
3 files changed, 77 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e920ff5..5973847 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2657,34 +2657,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2657 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2657 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2658 | 2658 | ||
2659 | // Do the verification here | 2659 | // Do the verification here |
2660 | System.Net.EndPoint ep = client.GetClientEP(); | 2660 | System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP(); |
2661 | if (aCircuit != null) | 2661 | if (aCircuit != null) |
2662 | { | 2662 | { |
2663 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | 2663 | if (!VerifyClient(aCircuit, ep, out vialogin)) |
2664 | { | 2664 | { |
2665 | m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 2665 | // uh-oh, this is fishy |
2666 | vialogin = true; | 2666 | m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", |
2667 | IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); | 2667 | client.AgentId, client.SessionId, ep.ToString()); |
2668 | if (userVerification != null && ep != null) | 2668 | try |
2669 | { | 2669 | { |
2670 | if (!userVerification.VerifyClient(aCircuit, ep.ToString())) | 2670 | client.Close(); |
2671 | { | 2671 | } |
2672 | // uh-oh, this is fishy | 2672 | catch (Exception e) |
2673 | m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.", | 2673 | { |
2674 | client.AgentId, client.SessionId, ep.ToString()); | 2674 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); |
2675 | try | ||
2676 | { | ||
2677 | client.Close(); | ||
2678 | } | ||
2679 | catch (Exception e) | ||
2680 | { | ||
2681 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); | ||
2682 | } | ||
2683 | return; | ||
2684 | } | ||
2685 | else | ||
2686 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} returned true", aCircuit.firstname, aCircuit.lastname); | ||
2687 | } | 2675 | } |
2676 | return; | ||
2688 | } | 2677 | } |
2689 | } | 2678 | } |
2690 | 2679 | ||
@@ -2710,7 +2699,65 @@ namespace OpenSim.Region.Framework.Scenes | |||
2710 | EventManager.TriggerOnClientLogin(client); | 2699 | EventManager.TriggerOnClientLogin(client); |
2711 | } | 2700 | } |
2712 | 2701 | ||
2713 | 2702 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) | |
2703 | { | ||
2704 | vialogin = false; | ||
2705 | |||
2706 | // Do the verification here | ||
2707 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | ||
2708 | { | ||
2709 | m_log.DebugFormat("[Scene]: Incoming client {0} {1} in region {2} via Login", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2710 | vialogin = true; | ||
2711 | IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); | ||
2712 | if (userVerification != null && ep != null) | ||
2713 | { | ||
2714 | if (!userVerification.VerifyClient(aCircuit, ep.Address.ToString())) | ||
2715 | { | ||
2716 | // uh-oh, this is fishy | ||
2717 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2718 | return false; | ||
2719 | } | ||
2720 | else | ||
2721 | m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | ||
2722 | } | ||
2723 | } | ||
2724 | |||
2725 | return true; | ||
2726 | } | ||
2727 | |||
2728 | // Called by Caps, on the first HTTP contact from the client | ||
2729 | public override bool CheckClient(UUID agentID, System.Net.IPEndPoint ep) | ||
2730 | { | ||
2731 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(agentID); | ||
2732 | if (aCircuit != null) | ||
2733 | { | ||
2734 | bool vialogin = false; | ||
2735 | if (!VerifyClient(aCircuit, ep, out vialogin)) | ||
2736 | { | ||
2737 | // if it doesn't pass, we remove the agentcircuitdata altogether | ||
2738 | // and the scene presence and the client, if they exist | ||
2739 | try | ||
2740 | { | ||
2741 | ScenePresence sp = GetScenePresence(agentID); | ||
2742 | if (sp != null) | ||
2743 | sp.ControllingClient.Close(); | ||
2744 | |||
2745 | // BANG! SLASH! | ||
2746 | m_authenticateHandler.RemoveCircuit(agentID); | ||
2747 | |||
2748 | return false; | ||
2749 | } | ||
2750 | catch (Exception e) | ||
2751 | { | ||
2752 | m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace); | ||
2753 | } | ||
2754 | } | ||
2755 | else | ||
2756 | return true; | ||
2757 | } | ||
2758 | |||
2759 | return false; | ||
2760 | } | ||
2714 | 2761 | ||
2715 | /// <summary> | 2762 | /// <summary> |
2716 | /// Register for events from the client | 2763 | /// 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] |