aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs97
-rw-r--r--OpenSim/Framework/RegionInfo.cs61
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs32
3 files changed, 155 insertions, 35 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 9d4bfea..f1b3ade 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -282,7 +282,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
282 /// </remarks> 282 /// </remarks>
283 public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request) 283 public XmlRpcResponse XmlRpcCreateRegionMethod(XmlRpcRequest request)
284 { 284 {
285 m_log.Info("[RADMIN]: Received Create Region Administrator Request"); 285 m_log.Info("[RADMIN]: CreateRegion: new request");
286 XmlRpcResponse response = new XmlRpcResponse(); 286 XmlRpcResponse response = new XmlRpcResponse();
287 Hashtable requestData = (Hashtable) request.Params[0]; 287 Hashtable requestData = (Hashtable) request.Params[0];
288 Hashtable responseData = new Hashtable(); 288 Hashtable responseData = new Hashtable();
@@ -291,7 +291,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
291 // check completeness 291 // check completeness
292 foreach (string p in new string[] { "password", 292 foreach (string p in new string[] { "password",
293 "region_name", "region_x", "region_y", 293 "region_name", "region_x", "region_y",
294 "region_master_first", "region_master_last", 294 "region_master_first", "region_master_last",
295 "region_master_password",
295 "listen_ip", "listen_port", "external_address"}) 296 "listen_ip", "listen_port", "external_address"})
296 { 297 {
297 if (!requestData.Contains(p)) 298 if (!requestData.Contains(p))
@@ -302,51 +303,79 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
302 if (!String.IsNullOrEmpty(requiredPassword) && 303 if (!String.IsNullOrEmpty(requiredPassword) &&
303 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 304 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
304 305
305 // bool persist = Convert.ToBoolean((string)requestData["persist"]); 306 // extract or generate region ID now
306 RegionInfo region = null; 307 Scene scene = null;
307 // if (!persist) 308 LLUUID regionID = LLUUID.Zero;
308 // {
309 // region = new RegionInfo();
310 // }
311 // else
312 // {
313 // region = new RegionInfo("DEFAULT REGION CONFIG",
314 // Path.Combine(regionConfigPath, "default.xml"), false);
315 // }
316 region = new RegionInfo();
317
318
319 if (requestData.ContainsKey("region_id") && 309 if (requestData.ContainsKey("region_id") &&
320 !String.IsNullOrEmpty((string) requestData["region_id"])) 310 !String.IsNullOrEmpty((string)requestData["region_id"]))
321 { 311 {
322 // FIXME: need to check whether region_id already 312 regionID = (string) requestData["region_id"];
323 // in use 313 if (m_app.SceneManager.TryGetScene(regionID, out scene))
324 region.RegionID = (string) requestData["region_id"]; 314 throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
315 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
316 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
325 } 317 }
326 else 318 else
327 { 319 {
328 region.RegionID = LLUUID.Random(); 320 regionID = LLUUID.Random();
321 m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID);
329 } 322 }
330 323
331 // FIXME: need to check whether region_name already 324 // create volatile or persistent region info
332 // in use 325 RegionInfo region = new RegionInfo();
326
327 region.RegionID = regionID;
333 region.RegionName = (string) requestData["region_name"]; 328 region.RegionName = (string) requestData["region_name"];
334 region.RegionLocX = Convert.ToUInt32((Int32) requestData["region_x"]); 329 region.RegionLocX = Convert.ToUInt32((Int32) requestData["region_x"]);
335 region.RegionLocY = Convert.ToUInt32((Int32) requestData["region_y"]); 330 region.RegionLocY = Convert.ToUInt32((Int32) requestData["region_y"]);
331
332 // check for collisions: region name, region UUID,
333 // region location
334 if (m_app.SceneManager.TryGetScene(region.RegionName, out scene))
335 throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
336 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
337 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
338
339 if (m_app.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene))
340 throw new Exception(String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>",
341 region.RegionLocX, region.RegionLocY,
342 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
343 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
336 344
337 // Security risk 345 // Security risk [and apparently not used]
338 if (requestData.ContainsKey("datastore")) 346 // if (requestData.ContainsKey("datastore"))
339 region.DataStore = (string) requestData["datastore"]; 347 // region.DataStore = (string) requestData["datastore"];
340 348
341 region.InternalEndPoint = 349 region.InternalEndPoint =
342 new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0); 350 new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0);
343 351
344 // FIXME: need to check whether listen_port already in use!
345 region.InternalEndPoint.Port = (Int32) requestData["listen_port"]; 352 region.InternalEndPoint.Port = (Int32) requestData["listen_port"];
353 if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene))
354 throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
355 region.InternalEndPoint.Address,
356 region.InternalEndPoint.Port,
357 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
358 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
359
360
346 region.ExternalHostName = (string) requestData["external_address"]; 361 region.ExternalHostName = (string) requestData["external_address"];
347 362
348 region.MasterAvatarFirstName = (string) requestData["region_master_first"]; 363 region.MasterAvatarFirstName = (string) requestData["region_master_first"];
349 region.MasterAvatarLastName = (string) requestData["region_master_last"]; 364 region.MasterAvatarLastName = (string) requestData["region_master_last"];
365 region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"];
366
367 bool persist = Convert.ToBoolean((string)requestData["persist"]);
368 if (persist)
369 {
370 string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"),
371 String.Format("{0}x{1}-{2}.xml",
372 region.RegionLocX.ToString(),
373 region.RegionLocY.ToString(),
374 regionID.ToString()));
375 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
376 region.RegionID, regionConfigPath);
377 region.SaveRegionToFile("dynamic region", regionConfigPath);
378 }
350 379
351 m_app.CreateRegion(region, true); 380 m_app.CreateRegion(region, true);
352 381
@@ -358,6 +387,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
358 } 387 }
359 catch (Exception e) 388 catch (Exception e)
360 { 389 {
390 m_log.ErrorFormat("[RADMIN] CreateRegion: failed {0}", e.Message);
391 m_log.DebugFormat("[RADMIN] CreateRegion: failed {0}", e.ToString());
392
361 responseData["success"] = "false"; 393 responseData["success"] = "false";
362 responseData["error"] = e.Message; 394 responseData["error"] = e.Message;
363 395
@@ -405,7 +437,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
405 /// </remarks> 437 /// </remarks>
406 public XmlRpcResponse XmlRpcCreateUserMethod(XmlRpcRequest request) 438 public XmlRpcResponse XmlRpcCreateUserMethod(XmlRpcRequest request)
407 { 439 {
408 m_log.Info("[RADMIN]: Received Create User Administrator Request"); 440 m_log.Info("[RADMIN]: CreateUser: new request");
409 XmlRpcResponse response = new XmlRpcResponse(); 441 XmlRpcResponse response = new XmlRpcResponse();
410 Hashtable requestData = (Hashtable) request.Params[0]; 442 Hashtable requestData = (Hashtable) request.Params[0];
411 Hashtable responseData = new Hashtable(); 443 Hashtable responseData = new Hashtable();
@@ -444,12 +476,12 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
444 476
445 response.Value = responseData; 477 response.Value = responseData;
446 478
447 m_log.InfoFormat("[RADMIN]: User {0} {1} created, UUID {2}", firstname, lastname, userID); 479 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID);
448 } 480 }
449 catch (Exception e) 481 catch (Exception e)
450 { 482 {
451 m_log.ErrorFormat("[RADMIN] create user: failed: {0}", e.Message); 483 m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
452 m_log.DebugFormat("[RADMIN] create user: failed: {0}", e.ToString()); 484 m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
453 485
454 responseData["success"] = "false"; 486 responseData["success"] = "false";
455 responseData["avatar_uuid"] = LLUUID.Zero.ToString(); 487 responseData["avatar_uuid"] = LLUUID.Zero.ToString();
@@ -471,8 +503,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
471 try 503 try
472 { 504 {
473 // check completeness 505 // check completeness
474 foreach (string p in new string[] { "password", 506 foreach (string p in new string[] { "password", "region_name", "filename" })
475 "region_name", "filename" })
476 { 507 {
477 if (!requestData.Contains(p)) 508 if (!requestData.Contains(p))
478 throw new Exception(String.Format("missing parameter {0}", p)); 509 throw new Exception(String.Format("missing parameter {0}", p));
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 7f284d3..da20edc 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -38,8 +38,8 @@ namespace OpenSim.Framework
38 [Serializable] 38 [Serializable]
39 public class SimpleRegionInfo 39 public class SimpleRegionInfo
40 { 40 {
41// private static readonly log4net.ILog m_log 41 // private static readonly log4net.ILog m_log
42// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 42 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 public SimpleRegionInfo() 44 public SimpleRegionInfo()
45 { 45 {
@@ -200,6 +200,9 @@ namespace OpenSim.Framework
200 200
201 public class RegionInfo : SimpleRegionInfo 201 public class RegionInfo : SimpleRegionInfo
202 { 202 {
203 // private static readonly log4net.ILog m_log
204 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
205
203 public string RegionName = String.Empty; 206 public string RegionName = String.Empty;
204 207
205 public string DataStore = String.Empty; 208 public string DataStore = String.Empty;
@@ -343,6 +346,60 @@ namespace OpenSim.Framework
343 } 346 }
344 } 347 }
345 348
349 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)
350 {
351 return true;
352 }
353
354 public void SaveRegionToFile(string description, string filename) {
355 configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
356 ignoreIncomingConfiguration, false);
357 configMember.performConfigurationRetrieve();
358 }
359
360 public void loadConfigurationOptionsFromMe()
361 {
362 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
363 "UUID of Region (Default is recommended, random UUID)",
364 RegionID.ToString(), true);
365 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
366 "Region Name", RegionName, true);
367 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
368 "Grid Location (X Axis)", m_regionLocX.ToString(), true);
369 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
370 "Grid Location (Y Axis)", m_regionLocY.ToString(), true);
371 //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
372 configMember.addConfigurationOption("internal_ip_address",
373 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
374 "Internal IP Address for incoming UDP client connections",
375 m_internalEndPoint.Address.ToString(),
376 true);
377 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
378 "Internal IP Port for incoming UDP client connections",
379 m_internalEndPoint.Port.ToString(), true);
380 configMember.addConfigurationOption("allow_alternate_ports",
381 ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
382 "Allow sim to find alternate UDP ports when ports are in use?",
383 m_allow_alternate_ports.ToString(), true);
384 configMember.addConfigurationOption("external_host_name",
385 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
386 "External Host Name", m_externalHostName, true);
387 configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
388 "Master Avatar UUID", MasterAvatarAssignedUUID.ToString(), true);
389 configMember.addConfigurationOption("estate_covanant_uuid",
390 ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant",
391 CovenantID.ToString(), true);
392 configMember.addConfigurationOption("master_avatar_first",
393 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
394 "First Name of Master Avatar", MasterAvatarFirstName, true);
395 configMember.addConfigurationOption("master_avatar_last",
396 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
397 "Last Name of Master Avatar", MasterAvatarLastName, true);
398 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
399 "(Sandbox Mode Only)Password for Master Avatar account",
400 MasterAvatarSandboxPassword, true);
401 }
402
346 public void loadConfigurationOptions() 403 public void loadConfigurationOptions()
347 { 404 {
348 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, 405 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 62994df..fbaf655 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -27,6 +27,8 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net;
31using System.Net.Sockets;
30using libsecondlife; 32using libsecondlife;
31using OpenSim.Framework; 33using OpenSim.Framework;
32using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
@@ -276,6 +278,36 @@ namespace OpenSim.Region.Environment.Scenes
276 return false; 278 return false;
277 } 279 }
278 280
281 public bool TryGetScene(uint locX, uint locY, out Scene scene)
282 {
283 foreach (Scene mscene in m_localScenes)
284 {
285 if (mscene.RegionInfo.RegionLocX == locX &&
286 mscene.RegionInfo.RegionLocY == locY)
287 {
288 scene = mscene;
289 return true;
290 }
291 }
292 scene = null;
293 return false;
294 }
295
296 public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene)
297 {
298 foreach (Scene mscene in m_localScenes)
299 {
300 if (mscene.RegionInfo.InternalEndPoint.Address == ipEndPoint.Address &&
301 mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port)
302 {
303 scene = mscene;
304 return true;
305 }
306 }
307 scene = null;
308 return false;
309 }
310
279 public void SetDebugPacketOnCurrentScene(int newDebug) 311 public void SetDebugPacketOnCurrentScene(int newDebug)
280 { 312 {
281 ForEachCurrentScene(delegate(Scene scene) 313 ForEachCurrentScene(delegate(Scene scene)