From 1f77f05f023f9ab45e9f8fd0109766a1fe151dba Mon Sep 17 00:00:00 2001 From: mores Date: Tue, 2 Nov 2010 21:46:45 -0400 Subject: [PATCH 1/5] Admin Server can now bind to a private ip address Signed-off-by: Melanie --- .../RemoteController/RemoteAdminPlugin.cs | 4 +++- OpenSim/Framework/MainServer.cs | 9 +++++++++ bin/OpenSim.ini.example | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 72ac3039d1..cbaa38b02b 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -116,7 +116,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController int port = m_config.GetInt("port", 0); m_application = openSim; - m_httpServer = MainServer.GetHttpServer((uint)port); + string bind_ip_address = m_config.GetString("bind_ip_address", "127.0.0.1"); + IPAddress ipaddr = IPAddress.Parse( bind_ip_address ); + m_httpServer = MainServer.GetHttpServer((uint)port,ipaddr); Dictionary availableMethods = new Dictionary(); availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 1f5f2088fc..8ccabece50 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Reflection; +using System.Net; using log4net; using OpenSim.Framework.Servers.HttpServer; @@ -47,6 +48,11 @@ namespace OpenSim.Framework } public static IHttpServer GetHttpServer(uint port) + { + return GetHttpServer(port,null); + } + + public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) { if (port == 0) return Instance; @@ -58,6 +64,9 @@ namespace OpenSim.Framework m_Servers[port] = new BaseHttpServer(port); + if (ipaddr != null ) + m_Servers[port].ListenIPAddress = ipaddr; + m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port); m_Servers[port].Start(); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 9d348548c0..669f534afb 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -326,6 +326,9 @@ ;; Set this to a nonzero value to have remote admin use a different port ; port = 0 + ;; Set this to the ip address that you want the admin server to bind to + ; bind_ip_address = 127.0.0.1 + ;# {access_password} {enabled:true} {Password for the remote admin interface} {} ;; This password is required to make any XMLRPC call (should be set as ;; the "password" parameter) From e76980bc496b414908ced8a9451631ff21ba5a17 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 01:09:42 +0000 Subject: [PATCH 2/5] Fix config items. Less used / expert items go in OpenSimDefaults.ini The default shown is always the hardcoded default --- bin/OpenSim.ini.example | 3 --- bin/OpenSimDefaults.ini | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 669f534afb..9d348548c0 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -326,9 +326,6 @@ ;; Set this to a nonzero value to have remote admin use a different port ; port = 0 - ;; Set this to the ip address that you want the admin server to bind to - ; bind_ip_address = 127.0.0.1 - ;# {access_password} {enabled:true} {Password for the remote admin interface} {} ;; This password is required to make any XMLRPC call (should be set as ;; the "password" parameter) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index de7c44ccf4..f98689b613 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -624,6 +624,9 @@ ; Set this to a nonzero value to have remote admin use a different port port = 0 + ; Set this to the ip address that you want the admin server to bind to + bind_ip_address = "0.0.0.0" + ; This password is required to make any XMLRPC call (should be set as the "password" parameter) access_password = unknown From c25f84e31c9ce20b887d2aba638962984ef20941 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 01:11:04 +0000 Subject: [PATCH 3/5] Change the default of the new bind_ip_address RemoteAdmin option to 0.0.0.0 so it reflects the prior default. We are not in the habot of changing default behavior without good reason and making localhost the default would break most current use cases. --- .../ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index cbaa38b02b..854307c1e8 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -116,7 +116,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController int port = m_config.GetInt("port", 0); m_application = openSim; - string bind_ip_address = m_config.GetString("bind_ip_address", "127.0.0.1"); + string bind_ip_address = m_config.GetString("bind_ip_address", "0.0.0.0"); IPAddress ipaddr = IPAddress.Parse( bind_ip_address ); m_httpServer = MainServer.GetHttpServer((uint)port,ipaddr); From 4ab9d37a8e556fe7f54d70db922eede861bce812 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 02:04:17 +0000 Subject: [PATCH 4/5] When LightShare is enabled, the standard day cycle is bypassed and replaced by midday defaults when no specific LightShare profile is set. This prevents LightShare info being send out when the region has no LightShare profile, allowing normal day/night cycles to happen. --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 1 + OpenSim/Framework/RegionInfo.cs | 1 + OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | 3 ++- .../Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index e2b69538e5..b53c67b912 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -817,6 +817,7 @@ namespace OpenSim.Data.MySQL nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); + nWP.valid = true; } } } diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 08d5398a18..176a523146 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -42,6 +42,7 @@ namespace OpenSim.Framework { public class RegionLightShareData : ICloneable { + public bool valid = false; public UUID regionID = UUID.Zero; public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); public float waterFogDensityExponent = 4.0f; diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 412dbb69c3..88f392dcdb 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs @@ -194,7 +194,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare } private void EventManager_OnSaveNewWindlightProfile() { - m_scene.ForEachScenePresence(SendProfileToClient); + if (m_scene.RegionInfo.WindlightSettings.valid) + m_scene.ForEachScenePresence(SendProfileToClient); } public void PostInitialise() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 665b39f6fc..24a93c5d8a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -455,6 +455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (LightShareModule.EnableWindlight) { RegionLightShareData wl = getWindlightProfileFromRules(rules); + wl.valid = true; m_host.ParentGroup.Scene.StoreWindlightProfile(wl); success = 1; } From 6c3b7617b0356f093ef2730f1c517d6228997984 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Nov 2010 02:31:43 +0000 Subject: [PATCH 5/5] Add lsClearWindlightScene() to the lightshare module to remove WL settings from a region and allow normal day cycles to be reestablished --- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 3 +++ OpenSim/Data/MySQL/MySQLSimulationData.cs | 15 +++++++++++++++ OpenSim/Data/Null/NullSimulationData.cs | 3 +++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 3 +++ .../Data/SQLiteLegacy/SQLiteSimulationData.cs | 3 +++ .../Interfaces/ISimulationDataService.cs | 1 + .../Interfaces/ISimulationDataStore.cs | 1 + .../Shared/Api/Implementation/LS_Api.cs | 17 +++++++++++++++++ .../Shared/Api/Interface/ILS_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LS_Stub.cs | 4 ++++ .../Simulation/SimulationDataService.cs | 4 ++++ .../Tests/Common/Mock/MockRegionDataPlugin.cs | 10 +++++++++- 12 files changed, 64 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 1da52b41e4..80ec65e246 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -705,6 +705,9 @@ VALUES //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index b53c67b912..ae78814f06 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -965,6 +965,21 @@ namespace OpenSim.Data.MySQL } } + public void RemoveRegionWindlightSettings(UUID regionID) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID"; + cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); + ExecuteNonQuery(cmd); + } + } + } + public void StoreRegionSettings(RegionSettings rs) { lock (m_dbLock) diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 34d3a4e38a..eb4e313f84 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -56,6 +56,9 @@ namespace OpenSim.Data.Null //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 9d49fb681f..bade0a1e9c 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -323,6 +323,9 @@ namespace OpenSim.Data.SQLite //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index ce18a428bb..4952cdf569 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -286,6 +286,9 @@ namespace OpenSim.Data.SQLiteLegacy //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs index edaa07c80f..5295a72976 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs @@ -94,5 +94,6 @@ namespace OpenSim.Region.Framework.Interfaces RegionSettings LoadRegionSettings(UUID regionUUID); RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); void StoreRegionWindlightSettings(RegionLightShareData wl); + void RemoveRegionWindlightSettings(UUID regionID); } } diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs index 0a4d531b91..615f3770d1 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.Framework.Interfaces RegionSettings LoadRegionSettings(UUID regionUUID); RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); void StoreRegionWindlightSettings(RegionLightShareData wl); + void RemoveRegionWindlightSettings(UUID regionID); void Shutdown(); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 24a93c5d8a..645566eaf0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -466,6 +466,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } return success; } + public void lsClearWindlightScene() + { + if (!m_LSFunctionsEnabled) + { + LSShoutError("LightShare functions are not enabled."); + return; + } + if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + { + LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); + return; + } + + m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false; + if (m_host.ParentGroup.Scene.SimulationDataService != null) + m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID); + } /// /// Set the current Windlight scene to a target avatar /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs index 9aa437b37e..f2df094abf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs @@ -44,5 +44,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List lsGetWindlightScene(LSL_List rules); int lsSetWindlightScene(LSL_List rules); int lsSetWindlightSceneTargeted(LSL_List rules, key target); + void lsClearWindlightScene(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs index f8dbe03ccc..143b497cd8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs @@ -72,5 +72,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target); } + public void lsClearWindlightScene() + { + m_LS_Functions.lsClearWindlightScene(); + } } } diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index c8ecb18bbc..0df9380547 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs @@ -144,5 +144,9 @@ namespace OpenSim.Services.Connectors { m_database.StoreRegionWindlightSettings(wl); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + m_database.RemoveRegionWindlightSettings(regionID); + } } } diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 2e5020b043..2ea36da228 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -104,6 +104,10 @@ namespace OpenSim.Data.Null return m_store.LoadRegionWindlightSettings(regionUUID); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) { m_store.StoreRegionWindlightSettings(wl); @@ -146,6 +150,10 @@ namespace OpenSim.Data.Null return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet @@ -274,4 +282,4 @@ namespace OpenSim.Data.Null { } } -} \ No newline at end of file +}