From f473252fa8022f95f60e219b24ffa342966f8c13 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 03:56:53 +0000 Subject: Add AllowRegionRestartFromClient setting to [EstateManagement] section of OpenSim.ini. Setting this to false will block all restart requests from the viewer even if they are otherwise legitimate. One use is to block region restarts if necessary whilst restart functionality remains buggy or triggers bugs in modules, though these should be fixed as soon as practicable. Default is true, as has been the case historically. --- .../World/Estate/EstateManagementModule.cs | 103 +++++++++++++-------- 1 file changed, 63 insertions(+), 40 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index f974a63..eb06fcc 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -53,6 +53,11 @@ namespace OpenSim.Region.CoreModules.World.Estate protected EstateManagementCommands m_commands; + /// + /// If false, region restart requests from the client are blocked even if they are otherwise legitimate. + /// + public bool AllowRegionRestartFromClient { get; set; } + private EstateTerrainXferHandler TerrainUploader; public TelehubManager m_Telehub; @@ -60,6 +65,53 @@ namespace OpenSim.Region.CoreModules.World.Estate public event ChangeDelegate OnEstateInfoChange; public event MessageDelegate OnEstateMessage; + #region Region Module interface + + public string Name { get { return "EstateManagementModule"; } } + + public Type ReplaceableInterface { get { return null; } } + + public void Initialise(IConfigSource source) + { + AllowRegionRestartFromClient = true; + + IConfig config = source.Configs["EstateManagement"]; + + if (config != null) + AllowRegionRestartFromClient = config.GetBoolean("AllowRegionRestartFromClient", true); + } + + public void AddRegion(Scene scene) + { + Scene = scene; + Scene.RegisterModuleInterface(this); + Scene.EventManager.OnNewClient += EventManager_OnNewClient; + Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; + + m_Telehub = new TelehubManager(scene); + + m_commands = new EstateManagementCommands(this); + m_commands.Initialise(); + } + + public void RemoveRegion(Scene scene) {} + + public void RegionLoaded(Scene scene) + { + // Sets up the sun module based no the saved Estate and Region Settings + // DO NOT REMOVE or the sun will stop working + scene.TriggerEstateSunUpdate(); + + UserManager = scene.RequestModuleInterface(); + } + + public void Close() + { + m_commands.Close(); + } + + #endregion + #region Packet Data Responders private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) @@ -184,6 +236,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; break; } + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); @@ -215,6 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; break; } + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionHandshakeToAll(); @@ -255,6 +309,12 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) { + if (!AllowRegionRestartFromClient) + { + remoteClient.SendAlertMessage("Region restart has been disabled on this simulator."); + return; + } + IRestartModule restartModule = Scene.RequestModuleInterface(); if (restartModule != null) { @@ -329,6 +389,7 @@ namespace OpenSim.Region.CoreModules.World.Estate } } + if ((estateAccessType & 8) != 0) // User remove { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) @@ -360,6 +421,7 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); } } + if ((estateAccessType & 16) != 0) // Group add { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) @@ -623,7 +685,7 @@ namespace OpenSim.Region.CoreModules.World.Estate } } - public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) + public void handleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) { SceneObjectPart part; @@ -1081,45 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Estate #endregion - #region Region Module interface - - public string Name { get { return "EstateManagementModule"; } } - - public Type ReplaceableInterface { get { return null; } } - - public void Initialise(IConfigSource source) {} - - public void AddRegion(Scene scene) - { - Scene = scene; - Scene.RegisterModuleInterface(this); - Scene.EventManager.OnNewClient += EventManager_OnNewClient; - Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; - - m_Telehub = new TelehubManager(scene); - - m_commands = new EstateManagementCommands(this); - m_commands.Initialise(); - } - - public void RemoveRegion(Scene scene) {} - - public void RegionLoaded(Scene scene) - { - // Sets up the sun module based no the saved Estate and Region Settings - // DO NOT REMOVE or the sun will stop working - scene.TriggerEstateSunUpdate(); - - UserManager = scene.RequestModuleInterface(); - } - - public void Close() - { - m_commands.Close(); - } - - #endregion - #region Other Functions public void changeWaterHeight(float height) -- cgit v1.1