aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/Application.cs117
-rw-r--r--OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs132
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs5
5 files changed, 208 insertions, 49 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 7721cdf..b860cf6 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -105,7 +105,7 @@ namespace OpenSim
105 105
106 // Check if the system is compatible with OpenSimulator. 106 // Check if the system is compatible with OpenSimulator.
107 // Ensures that the minimum system requirements are met 107 // Ensures that the minimum system requirements are met
108 m_log.Info("Performing compatibility checks... "); 108 m_log.Info("Performing compatibility checks... \n");
109 string supported = String.Empty; 109 string supported = String.Empty;
110 if (Util.IsEnvironmentSupported(ref supported)) 110 if (Util.IsEnvironmentSupported(ref supported))
111 { 111 {
@@ -120,6 +120,113 @@ namespace OpenSim
120 Culture.SetCurrentCulture(); 120 Culture.SetCurrentCulture();
121 121
122 122
123 // Validate that the user has the most basic configuration done
124 // If not, offer to do the most basic configuration for them warning them along the way of the importance of
125 // reading these files.
126 /*
127 m_log.Info("Checking for reguired configuration...\n");
128
129 bool OpenSim_Ini = (File.Exists(Path.Combine(Util.configDir(), "OpenSim.ini")))
130 || (File.Exists(Path.Combine(Util.configDir(), "opensim.ini")))
131 || (File.Exists(Path.Combine(Util.configDir(), "openSim.ini")))
132 || (File.Exists(Path.Combine(Util.configDir(), "Opensim.ini")));
133
134 bool StanaloneCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini"));
135 bool StanaloneCommon_lowercased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "standalonecommon.ini"));
136 bool GridCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "GridCommon.ini"));
137 bool GridCommon_lowerCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "gridcommon.ini"));
138
139 if ((OpenSim_Ini)
140 && (
141 (StanaloneCommon_ProperCased
142 || StanaloneCommon_lowercased
143 || GridCommon_ProperCased
144 || GridCommon_lowerCased
145 )))
146 {
147 m_log.Info("Required Configuration Files Found\n");
148 }
149 else
150 {
151 MainConsole.Instance = new LocalConsole("Region");
152 string resp = MainConsole.Instance.CmdPrompt(
153 "\n\n*************Required Configuration files not found.*************\n\n OpenSimulator will not run without these files.\n\nRemember, these file names are Case Sensitive in Linux and Proper Cased.\n1. ./OpenSim.ini\nand\n2. ./config-include/StandaloneCommon.ini \nor\n3. ./config-include/GridCommon.ini\n\nAlso, you will want to examine these files in great detail because only the basic system will load by default. OpenSimulator can do a LOT more if you spend a little time going through these files.\n\n" + ": " + "Do you want to copy the most basic Defaults from standalone?",
154 "yes");
155 if (resp == "yes")
156 {
157
158 if (!(OpenSim_Ini))
159 {
160 try
161 {
162 File.Copy(Path.Combine(Util.configDir(), "OpenSim.ini.example"),
163 Path.Combine(Util.configDir(), "OpenSim.ini"));
164 } catch (UnauthorizedAccessException)
165 {
166 MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, Make sure OpenSim has have the required permissions\n");
167 } catch (ArgumentException)
168 {
169 MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, The current directory is invalid.\n");
170 } catch (System.IO.PathTooLongException)
171 {
172 MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the Path to these files is too long.\n");
173 } catch (System.IO.DirectoryNotFoundException)
174 {
175 MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the current directory is reporting as not found.\n");
176 } catch (System.IO.FileNotFoundException)
177 {
178 MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n");
179 } catch (System.IO.IOException)
180 {
181 // Destination file exists already or a hard drive failure... .. so we can just drop this one
182 //MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n");
183 } catch (System.NotSupportedException)
184 {
185 MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, The current directory is invalid.\n");
186 }
187
188 }
189 if (!(StanaloneCommon_ProperCased || StanaloneCommon_lowercased))
190 {
191 try
192 {
193 File.Copy(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini.example"),
194 Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini"));
195 }
196 catch (UnauthorizedAccessException)
197 {
198 MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, Make sure OpenSim has the required permissions\n");
199 }
200 catch (ArgumentException)
201 {
202 MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, The current directory is invalid.\n");
203 }
204 catch (System.IO.PathTooLongException)
205 {
206 MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the Path to these files is too long.\n");
207 }
208 catch (System.IO.DirectoryNotFoundException)
209 {
210 MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the current directory is reporting as not found.\n");
211 }
212 catch (System.IO.FileNotFoundException)
213 {
214 MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the example is not found, please make sure that the example files exist.\n");
215 }
216 catch (System.IO.IOException)
217 {
218 // Destination file exists already or a hard drive failure... .. so we can just drop this one
219 //MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n");
220 }
221 catch (System.NotSupportedException)
222 {
223 MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, The current directory is invalid.\n");
224 }
225 }
226 }
227 MainConsole.Instance = null;
228 }
229 */
123 configSource.Alias.AddAlias("On", true); 230 configSource.Alias.AddAlias("On", true);
124 configSource.Alias.AddAlias("Off", false); 231 configSource.Alias.AddAlias("Off", false);
125 configSource.Alias.AddAlias("True", true); 232 configSource.Alias.AddAlias("True", true);
@@ -145,6 +252,8 @@ namespace OpenSim
145 // load Crash directory config 252 // load Crash directory config
146 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); 253 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
147 254
255
256
148 if (background) 257 if (background)
149 { 258 {
150 m_sim = new OpenSimBackground(configSource); 259 m_sim = new OpenSimBackground(configSource);
@@ -152,8 +261,14 @@ namespace OpenSim
152 } 261 }
153 else 262 else
154 { 263 {
264
265
266
267
155 m_sim = new OpenSim(configSource); 268 m_sim = new OpenSim(configSource);
156 269
270
271
157 m_sim.Startup(); 272 m_sim.Startup();
158 273
159 while (true) 274 while (true)
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..de8ecc2 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 {
2644 // uh-oh, this is fishy
2645 m_log.WarnFormat("[Scene]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
2646 client.AgentId, client.SessionId, ep.ToString());
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 } 2643 }
2644 catch (Exception e)
2645 {
2646 m_log.DebugFormat("[Scene]: Exception while closing aborted client: {0}", e.StackTrace);
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
@@ -3308,7 +3355,6 @@ namespace OpenSim.Region.Framework.Scenes
3308 /// </summary> 3355 /// </summary>
3309 public void RegisterCommsEvents() 3356 public void RegisterCommsEvents()
3310 { 3357 {
3311 m_sceneGridService.OnExpectUser += HandleNewUserConnection;
3312 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 3358 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
3313 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; 3359 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
3314 //m_eventManager.OnRegionUp += OtherRegionUp; 3360 //m_eventManager.OnRegionUp += OtherRegionUp;
@@ -3329,7 +3375,6 @@ namespace OpenSim.Region.Framework.Scenes
3329 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; 3375 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
3330 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 3376 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3331 //m_eventManager.OnRegionUp -= OtherRegionUp; 3377 //m_eventManager.OnRegionUp -= OtherRegionUp;
3332 m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
3333 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 3378 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
3334 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; 3379 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
3335 m_sceneGridService.OnGetLandData -= GetLandData; 3380 m_sceneGridService.OnGetLandData -= GetLandData;
@@ -3341,22 +3386,6 @@ namespace OpenSim.Region.Framework.Scenes
3341 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); 3386 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
3342 } 3387 }
3343 3388
3344 /// <summary>
3345 /// A handler for the SceneCommunicationService event, to match that events return type of void.
3346 /// Use NewUserConnection() directly if possible so the return type can refuse connections.
3347 /// At the moment nothing actually seems to use this event,
3348 /// as everything is switching to calling the NewUserConnection method directly.
3349 ///
3350 /// Now obsoleting this because it doesn't handle teleportFlags propertly
3351 ///
3352 /// </summary>
3353 /// <param name="agent"></param>
3354 [Obsolete("Please call NewUserConnection directly.")]
3355 public void HandleNewUserConnection(AgentCircuitData agent)
3356 {
3357 string reason;
3358 NewUserConnection(agent, 0, out reason);
3359 }
3360 3389
3361 /// <summary> 3390 /// <summary>
3362 /// Do the work necessary to initiate a new user connection for a particular scene. 3391 /// Do the work necessary to initiate a new user connection for a particular scene.
@@ -3418,13 +3447,22 @@ namespace OpenSim.Region.Framework.Scenes
3418 ScenePresence sp = GetScenePresence(agent.AgentID); 3447 ScenePresence sp = GetScenePresence(agent.AgentID);
3419 if (sp != null) 3448 if (sp != null)
3420 { 3449 {
3421 m_log.DebugFormat( 3450 if (sp.IsChildAgent)
3422 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", 3451 {
3423 agent.AgentID, RegionInfo.RegionName); 3452 m_log.DebugFormat(
3453 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}",
3454 agent.AgentID, RegionInfo.RegionName);
3424 3455
3425 sp.AdjustKnownSeeds(); 3456 sp.AdjustKnownSeeds();
3426 3457
3427 return true; 3458 return true;
3459 }
3460 else
3461 {
3462 // We have a zombie from a crashed session. Kill it.
3463 m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName);
3464 sp.ControllingClient.Close();
3465 }
3428 } 3466 }
3429 3467
3430 CapsModule.AddCapsHandler(agent.AgentID); 3468 CapsModule.AddCapsHandler(agent.AgentID);
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]