diff options
author | UbitUmarov | 2017-04-05 15:11:19 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-05 15:11:19 +0100 |
commit | c0904a32cb281bad39497b091e758f2433adc196 (patch) | |
tree | 9667ce494ca9f78b220796c2adbf0b52fe5d966f /OpenSim/Region/ScriptEngine | |
parent | fix osTeleportObject OSFunctionThreatLevel setting on osslEnable.ini (diff) | |
download | opensim-SC-c0904a32cb281bad39497b091e758f2433adc196.zip opensim-SC-c0904a32cb281bad39497b091e758f2433adc196.tar.gz opensim-SC-c0904a32cb281bad39497b091e758f2433adc196.tar.bz2 opensim-SC-c0904a32cb281bad39497b091e758f2433adc196.tar.xz |
OSSL CheckThreatLevel() with no arguments only tests if OSSL is enabled. Faster test for safe functions that are always allowed with OSSL enabled. other name could be CheckOSSLenabled, but this name preserves functions template.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a6f6a80..b3bd8c4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -260,7 +260,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
260 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); | 260 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); |
261 | } | 261 | } |
262 | 262 | ||
263 | // Returns of the function is allowed. Throws a script exception if not allowed. | 263 | // Returns if OSSL is enabled. Throws a script exception if OSSL is not allowed.. |
264 | // for safe funtions always active | ||
265 | public void CheckThreatLevel() | ||
266 | { | ||
267 | if (!m_OSFunctionsEnabled) | ||
268 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws | ||
269 | } | ||
270 | |||
271 | // Returns if the function is allowed. Throws a script exception if not allowed. | ||
264 | public void CheckThreatLevel(ThreatLevel level, string function) | 272 | public void CheckThreatLevel(ThreatLevel level, string function) |
265 | { | 273 | { |
266 | if (!m_OSFunctionsEnabled) | 274 | if (!m_OSFunctionsEnabled) |
@@ -1716,7 +1724,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1716 | 1724 | ||
1717 | public LSL_Integer osCheckODE() | 1725 | public LSL_Integer osCheckODE() |
1718 | { | 1726 | { |
1727 | CheckThreatLevel(); | ||
1719 | m_host.AddScriptLPS(1); | 1728 | m_host.AddScriptLPS(1); |
1729 | |||
1720 | LSL_Integer ret = 0; // false | 1730 | LSL_Integer ret = 0; // false |
1721 | if (m_ScriptEngine.World.PhysicsScene != null) | 1731 | if (m_ScriptEngine.World.PhysicsScene != null) |
1722 | { | 1732 | { |
@@ -1757,10 +1767,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1757 | 1767 | ||
1758 | public string osGetPhysicsEngineName() | 1768 | public string osGetPhysicsEngineName() |
1759 | { | 1769 | { |
1760 | // not doing security checks | 1770 | CheckThreatLevel(); |
1761 | // this whould limit the use of this | ||
1762 | |||
1763 | m_host.AddScriptLPS(1); | 1771 | m_host.AddScriptLPS(1); |
1772 | |||
1764 | string ret = "NoEngine"; | 1773 | string ret = "NoEngine"; |
1765 | if (m_ScriptEngine.World.PhysicsScene != null) | 1774 | if (m_ScriptEngine.World.PhysicsScene != null) |
1766 | { | 1775 | { |
@@ -1771,6 +1780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1771 | } | 1780 | } |
1772 | return ret; | 1781 | return ret; |
1773 | } | 1782 | } |
1783 | |||
1774 | public string osGetSimulatorVersion() | 1784 | public string osGetSimulatorVersion() |
1775 | { | 1785 | { |
1776 | // High because it can be used to target attacks to known weaknesses | 1786 | // High because it can be used to target attacks to known weaknesses |
@@ -4364,6 +4374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4364 | 4374 | ||
4365 | public void osCollisionSound(string impact_sound, double impact_volume) | 4375 | public void osCollisionSound(string impact_sound, double impact_volume) |
4366 | { | 4376 | { |
4377 | CheckThreatLevel(); | ||
4367 | m_host.AddScriptLPS(1); | 4378 | m_host.AddScriptLPS(1); |
4368 | 4379 | ||
4369 | if(impact_sound == "") | 4380 | if(impact_sound == "") |
@@ -4396,6 +4407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4396 | // still not very usefull, detector is lost on rez, restarts, etc | 4407 | // still not very usefull, detector is lost on rez, restarts, etc |
4397 | public void osVolumeDetect(int detect) | 4408 | public void osVolumeDetect(int detect) |
4398 | { | 4409 | { |
4410 | CheckThreatLevel(); | ||
4399 | m_host.AddScriptLPS(1); | 4411 | m_host.AddScriptLPS(1); |
4400 | 4412 | ||
4401 | if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment) | 4413 | if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment) |
@@ -4418,6 +4430,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4418 | /// </returns> | 4430 | /// </returns> |
4419 | public LSL_List osGetInertiaData() | 4431 | public LSL_List osGetInertiaData() |
4420 | { | 4432 | { |
4433 | CheckThreatLevel(); | ||
4421 | m_host.AddScriptLPS(1); | 4434 | m_host.AddScriptLPS(1); |
4422 | 4435 | ||
4423 | LSL_List result = new LSL_List(); | 4436 | LSL_List result = new LSL_List(); |
@@ -4465,7 +4478,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4465 | 4478 | ||
4466 | public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot) | 4479 | public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot) |
4467 | { | 4480 | { |
4481 | CheckThreatLevel(); | ||
4468 | m_host.AddScriptLPS(1); | 4482 | m_host.AddScriptLPS(1); |
4483 | |||
4469 | SceneObjectGroup sog = m_host.ParentGroup; | 4484 | SceneObjectGroup sog = m_host.ParentGroup; |
4470 | if(sog== null || sog.IsDeleted) | 4485 | if(sog== null || sog.IsDeleted) |
4471 | return; | 4486 | return; |
@@ -4502,6 +4517,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4502 | /// </remarks> | 4517 | /// </remarks> |
4503 | public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot) | 4518 | public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot) |
4504 | { | 4519 | { |
4520 | CheckThreatLevel(); | ||
4505 | m_host.AddScriptLPS(1); | 4521 | m_host.AddScriptLPS(1); |
4506 | 4522 | ||
4507 | SceneObjectGroup sog = m_host.ParentGroup; | 4523 | SceneObjectGroup sog = m_host.ParentGroup; |
@@ -4543,7 +4559,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4543 | /// </remarks> | 4559 | /// </remarks> |
4544 | public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass) | 4560 | public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass) |
4545 | { | 4561 | { |
4562 | CheckThreatLevel(); | ||
4546 | m_host.AddScriptLPS(1); | 4563 | m_host.AddScriptLPS(1); |
4564 | |||
4547 | SceneObjectGroup sog = m_host.ParentGroup; | 4565 | SceneObjectGroup sog = m_host.ParentGroup; |
4548 | if(sog== null || sog.IsDeleted) | 4566 | if(sog== null || sog.IsDeleted) |
4549 | return; | 4567 | return; |
@@ -4581,7 +4599,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4581 | /// </remarks> | 4599 | /// </remarks> |
4582 | public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot) | 4600 | public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot) |
4583 | { | 4601 | { |
4602 | CheckThreatLevel(); | ||
4584 | m_host.AddScriptLPS(1); | 4603 | m_host.AddScriptLPS(1); |
4604 | |||
4585 | SceneObjectGroup sog = m_host.ParentGroup; | 4605 | SceneObjectGroup sog = m_host.ParentGroup; |
4586 | if(sog== null || sog.IsDeleted) | 4606 | if(sog== null || sog.IsDeleted) |
4587 | return; | 4607 | return; |
@@ -4618,7 +4638,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4618 | /// </summary> | 4638 | /// </summary> |
4619 | public void osClearInertia() | 4639 | public void osClearInertia() |
4620 | { | 4640 | { |
4641 | CheckThreatLevel(); | ||
4621 | m_host.AddScriptLPS(1); | 4642 | m_host.AddScriptLPS(1); |
4643 | |||
4622 | SceneObjectGroup sog = m_host.ParentGroup; | 4644 | SceneObjectGroup sog = m_host.ParentGroup; |
4623 | if(sog== null || sog.IsDeleted) | 4645 | if(sog== null || sog.IsDeleted) |
4624 | return; | 4646 | return; |
@@ -4666,7 +4688,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4666 | 4688 | ||
4667 | public LSL_Integer osGetLinkNumber(LSL_String name) | 4689 | public LSL_Integer osGetLinkNumber(LSL_String name) |
4668 | { | 4690 | { |
4691 | CheckThreatLevel(); | ||
4669 | m_host.AddScriptLPS(1); | 4692 | m_host.AddScriptLPS(1); |
4693 | |||
4670 | SceneObjectGroup sog = m_host.ParentGroup; | 4694 | SceneObjectGroup sog = m_host.ParentGroup; |
4671 | if(sog== null || sog.IsDeleted) | 4695 | if(sog== null || sog.IsDeleted) |
4672 | return -1; | 4696 | return -1; |