From 99a23421a87b7a988bfe4e986ee09d3938cdb149 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Mon, 27 Aug 2018 21:36:45 +0200 Subject: [PATCH] Adding check permission CanIssueEstateCommand for osRegionNotice and new function osRegionNotice(string agentID, string msg) Signed-off-by: UbitUmarov --- .../Shared/Api/Implementation/OSSL_Api.cs | 37 +++++++++++++++---- .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 505d4e55fe..b74490cd0e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -628,16 +628,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osRegionNotice(string msg) { - // This implementation provides absolutely no security - // It's high griefing potential makes this classification - // necessary - // - CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice"); + CheckThreatLevel(ThreatLevel.High, "osRegionNotice"); IDialogModule dm = World.RequestModuleInterface(); + if (dm == null) + return; - if (dm != null) - dm.SendGeneralAlert(msg); + if (!World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false)) + return; + + dm.SendGeneralAlert(msg + "\n"); + } + + public void osRegionNotice(string agentID, string msg) + { + CheckThreatLevel(ThreatLevel.High, "osRegionNotice"); + + if (!UUID.TryParse(agentID, out UUID avatarID)) + return; + + if (!World.TryGetScenePresence(avatarID, out ScenePresence sp)) + return; + + if (sp.IsChildAgent || sp.IsDeleted || sp.IsInTransit || sp.IsNPC) + return; + + IDialogModule dm = World.RequestModuleInterface(); + if (dm == null) + return; + + if (!World.Permissions.CanIssueEstateCommand(m_host.OwnerID, false)) + return; + + dm.SendAlertToUser(sp.ControllingClient, msg + "\n", false); } public void osSetRot(UUID target, Quaternion rotation) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 5ed628fac2..10478e8f79 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -138,6 +138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces int osRegionRestart(double seconds); int osRegionRestart(double seconds, string msg); void osRegionNotice(string msg); + void osRegionNotice(string agentID, string msg); bool osConsoleCommand(string Command); void osSetParcelMediaURL(string url); void osSetPrimFloatOnWater(int floatYN); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 5cf2cdb867..5f7841e8bc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -225,6 +225,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osRegionNotice(msg); } + public void osRegionNotice(string agentID, string msg) + { + m_OSSL_Functions.osRegionNotice(agentID, msg); + } + public bool osConsoleCommand(string Command) { return m_OSSL_Functions.osConsoleCommand(Command);