diff options
author | onefang | 2019-08-22 10:54:20 +1000 |
---|---|---|
committer | onefang | 2019-08-22 10:54:20 +1000 |
commit | 5ab0f0190d93759368d2f6e4553a8da2644bc638 (patch) | |
tree | 5ac2f78610505a1e4d4473d117276e766a5aa3e1 | |
parent | Unclutter the tmux status line. (diff) | |
download | opensim-SC_OLD-5ab0f0190d93759368d2f6e4553a8da2644bc638.zip opensim-SC_OLD-5ab0f0190d93759368d2f6e4553a8da2644bc638.tar.gz opensim-SC_OLD-5ab0f0190d93759368d2f6e4553a8da2644bc638.tar.bz2 opensim-SC_OLD-5ab0f0190d93759368d2f6e4553a8da2644bc638.tar.xz |
OhSillyThreatLevels should throw an exception when not allowed.
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 10 |
1 files changed, 3 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 64da67e..544dce4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -212,9 +212,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
212 | internal void OSSLError(string msg) | 212 | internal void OSSLError(string msg) |
213 | { | 213 | { |
214 | if (m_debuggerSafe) | 214 | if (m_debuggerSafe) |
215 | { | ||
216 | OSSLShoutError(msg); | 215 | OSSLShoutError(msg); |
217 | } | ||
218 | else | 216 | else |
219 | { | 217 | { |
220 | throw new ScriptException("OSSL Runtime Error: " + msg); | 218 | throw new ScriptException("OSSL Runtime Error: " + msg); |
@@ -258,20 +256,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
258 | public void CheckThreatLevel() | 256 | public void CheckThreatLevel() |
259 | { | 257 | { |
260 | if (!m_OSFunctionsEnabled) | 258 | if (!m_OSFunctionsEnabled) |
261 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws | 259 | throw new ScriptException(String.Format("{0} permission denied. All OS functions are disabled.")); |
262 | } | 260 | } |
263 | 261 | ||
264 | // Returns if the function is allowed. Throws a script exception if not allowed. | 262 | // Returns if the function is allowed. Throws a script exception if not allowed. |
265 | public void CheckThreatLevel(ThreatLevel level, string function) | 263 | public void CheckThreatLevel(ThreatLevel level, string function) |
266 | { | 264 | { |
267 | if (!m_OSFunctionsEnabled) | 265 | if (!m_OSFunctionsEnabled) |
268 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws | 266 | throw new ScriptException(String.Format("{0} permission denied. All OS functions are disabled.", function)); |
269 | 267 | ||
270 | string reasonWhyNot = CheckThreatLevelTest(level, function); | 268 | string reasonWhyNot = CheckThreatLevelTest(level, function); |
271 | if (!String.IsNullOrEmpty(reasonWhyNot)) | 269 | if (!String.IsNullOrEmpty(reasonWhyNot)) |
272 | { | 270 | throw new ScriptException(reasonWhyNot); |
273 | OSSLError(reasonWhyNot); | ||
274 | } | ||
275 | } | 271 | } |
276 | 272 | ||
277 | // Check to see if function is allowed. Returns an empty string if function permitted | 273 | // Check to see if function is allowed. Returns an empty string if function permitted |