aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-15 22:52:23 +0000
committerMelanie Thielker2008-09-15 22:52:23 +0000
commit2df0499da714178f192132ddf9f46069b24dc59c (patch)
treef0469349dcbdb58bb4b91b6d0efcb494df1f8ab5 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
parent* minor: recomment the console c# script printout I accidentally left in on t... (diff)
downloadopensim-SC_OLD-2df0499da714178f192132ddf9f46069b24dc59c.zip
opensim-SC_OLD-2df0499da714178f192132ddf9f46069b24dc59c.tar.gz
opensim-SC_OLD-2df0499da714178f192132ddf9f46069b24dc59c.tar.bz2
opensim-SC_OLD-2df0499da714178f192132ddf9f46069b24dc59c.tar.xz
Refactor the os functions allowed check into the threat check method
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs189
1 files changed, 5 insertions, 184 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index cba0757..9a01025 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -179,6 +179,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
179 179
180 protected void CheckThreatLevel(ThreatLevel level, string function) 180 protected void CheckThreatLevel(ThreatLevel level, string function)
181 { 181 {
182 if (!m_OSFunctionsEnabled)
183 OSSLError(function+": permission denied"); // throws
184
182 if (!m_FunctionPerms.ContainsKey(function)) 185 if (!m_FunctionPerms.ContainsKey(function))
183 { 186 {
184 m_FunctionPerms[function] = 187 m_FunctionPerms[function] =
@@ -206,11 +209,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
206 209
207 public int osTerrainSetHeight(int x, int y, double val) 210 public int osTerrainSetHeight(int x, int y, double val)
208 { 211 {
209 if (!m_OSFunctionsEnabled)
210 {
211 OSSLError("osTerrainSetHeight: permission denied");
212 return 0;
213 }
214 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); 212 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight");
215 213
216 m_host.AddScriptLPS(1); 214 m_host.AddScriptLPS(1);
@@ -230,11 +228,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
230 228
231 public double osTerrainGetHeight(int x, int y) 229 public double osTerrainGetHeight(int x, int y)
232 { 230 {
233 if (!m_OSFunctionsEnabled)
234 {
235 OSSLError("osTerrainGetHeight: permission denied");
236 return 0.0;
237 }
238 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); 231 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight");
239 232
240 m_host.AddScriptLPS(1); 233 m_host.AddScriptLPS(1);
@@ -246,11 +239,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
246 239
247 public int osRegionRestart(double seconds) 240 public int osRegionRestart(double seconds)
248 { 241 {
249 if (!m_OSFunctionsEnabled)
250 {
251 OSSLError("osRegionRestart: permission denied");
252 return 0;
253 }
254 // This is High here because region restart is not reliable 242 // This is High here because region restart is not reliable
255 // it may result in the region staying down or becoming 243 // it may result in the region staying down or becoming
256 // unstable. This should be changed to Low or VeryLow once 244 // unstable. This should be changed to Low or VeryLow once
@@ -273,12 +261,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
273 261
274 public void osRegionNotice(string msg) 262 public void osRegionNotice(string msg)
275 { 263 {
276 if (!m_OSFunctionsEnabled)
277 {
278 OSSLError("osRegionNotice: permission denied");
279 return;
280 }
281
282 // This implementation provides absolutely no security 264 // This implementation provides absolutely no security
283 // It's high griefing potential makes this classification 265 // It's high griefing potential makes this classification
284 // necessary 266 // necessary
@@ -291,12 +273,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
291 273
292 public void osSetRot(UUID target, Quaternion rotation) 274 public void osSetRot(UUID target, Quaternion rotation)
293 { 275 {
294 if (!m_OSFunctionsEnabled)
295 {
296 OSSLError("osSetRot: permission denied");
297 return;
298 }
299
300 // This function has no security. It can be used to destroy 276 // This function has no security. It can be used to destroy
301 // arbitrary builds the user would normally have no rights to 277 // arbitrary builds the user would normally have no rights to
302 // 278 //
@@ -316,12 +292,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
316 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, 292 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
317 int timer) 293 int timer)
318 { 294 {
319 if (!m_OSFunctionsEnabled)
320 {
321 OSSLError("osSetDynamicTextureURL: permission denied");
322 return String.Empty;
323 }
324
325 // This may be upgraded depending on the griefing or DOS 295 // This may be upgraded depending on the griefing or DOS
326 // potential, or guarded with a delay 296 // potential, or guarded with a delay
327 // 297 //
@@ -347,12 +317,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
347 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, 317 public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
348 int timer, int alpha) 318 int timer, int alpha)
349 { 319 {
350 if (!m_OSFunctionsEnabled)
351 {
352 OSSLError("osSetDynamicTextureURLBlend: permission denied");
353 return String.Empty;
354 }
355
356 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlend"); 320 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlend");
357 321
358 m_host.AddScriptLPS(1); 322 m_host.AddScriptLPS(1);
@@ -375,12 +339,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
375 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, 339 public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams,
376 int timer) 340 int timer)
377 { 341 {
378 if (!m_OSFunctionsEnabled)
379 {
380 OSSLError("osSetDynamicTextureData: permission denied");
381 return String.Empty;
382 }
383
384 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureData"); 342 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureData");
385 343
386 m_host.AddScriptLPS(1); 344 m_host.AddScriptLPS(1);
@@ -410,12 +368,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
410 public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, 368 public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
411 int timer, int alpha) 369 int timer, int alpha)
412 { 370 {
413 if (!m_OSFunctionsEnabled)
414 {
415 OSSLError("osSetDynamicTextureDataBlend: permission denied");
416 return String.Empty;
417 }
418
419 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlend"); 371 CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlend");
420 372
421 m_host.AddScriptLPS(1); 373 m_host.AddScriptLPS(1);
@@ -444,15 +396,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
444 396
445 public bool osConsoleCommand(string command) 397 public bool osConsoleCommand(string command)
446 { 398 {
447 m_host.AddScriptLPS(1);
448 if (!m_OSFunctionsEnabled)
449 {
450 OSSLError("osConsoleCommand: permission denied");
451 return false;
452 }
453
454 CheckThreatLevel(ThreatLevel.Severe, "osConsoleCommand"); 399 CheckThreatLevel(ThreatLevel.Severe, "osConsoleCommand");
455 400
401 m_host.AddScriptLPS(1);
402
456 if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID)) 403 if (World.ExternalChecks.ExternalChecksCanRunConsoleCommand(m_host.OwnerID))
457 { 404 {
458 MainConsole.Instance.RunCommand(command); 405 MainConsole.Instance.RunCommand(command);
@@ -463,12 +410,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
463 410
464 public void osSetPrimFloatOnWater(int floatYN) 411 public void osSetPrimFloatOnWater(int floatYN)
465 { 412 {
466 if (!m_OSFunctionsEnabled)
467 {
468 OSSLError("osSetPrimFloatOnWater: permission denied");
469 return;
470 }
471
472 CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); 413 CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater");
473 414
474 m_host.AddScriptLPS(1); 415 m_host.AddScriptLPS(1);
@@ -484,12 +425,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
484 // Teleport functions 425 // Teleport functions
485 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 426 public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
486 { 427 {
487 if (!m_OSFunctionsEnabled)
488 {
489 OSSLError("osTeleportAgent: permission denied");
490 return;
491 }
492
493 // High because there is no security check. High griefer potential 428 // High because there is no security check. High griefer potential
494 // 429 //
495 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 430 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
@@ -521,12 +456,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
521 // Adam's super super custom animation functions 456 // Adam's super super custom animation functions
522 public void osAvatarPlayAnimation(string avatar, string animation) 457 public void osAvatarPlayAnimation(string avatar, string animation)
523 { 458 {
524 if (!m_OSFunctionsEnabled)
525 {
526 OSSLError("osAvatarPlayAnimation: permission denied");
527 return;
528 }
529
530 CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); 459 CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation");
531 460
532 m_host.AddScriptLPS(1); 461 m_host.AddScriptLPS(1);
@@ -539,12 +468,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
539 468
540 public void osAvatarStopAnimation(string avatar, string animation) 469 public void osAvatarStopAnimation(string avatar, string animation)
541 { 470 {
542 if (!m_OSFunctionsEnabled)
543 {
544 OSSLError("osAvatarStopAnimation: permission denied");
545 return;
546 }
547
548 CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); 471 CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation");
549 472
550 m_host.AddScriptLPS(1); 473 m_host.AddScriptLPS(1);
@@ -558,12 +481,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
558 //Texture draw functions 481 //Texture draw functions
559 public string osMovePen(string drawList, int x, int y) 482 public string osMovePen(string drawList, int x, int y)
560 { 483 {
561 if (!m_OSFunctionsEnabled)
562 {
563 OSSLError("osMovePen: permission denied");
564 return String.Empty;
565 }
566
567 CheckThreatLevel(ThreatLevel.None, "osMovePen"); 484 CheckThreatLevel(ThreatLevel.None, "osMovePen");
568 485
569 m_host.AddScriptLPS(1); 486 m_host.AddScriptLPS(1);
@@ -573,12 +490,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
573 490
574 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY) 491 public string osDrawLine(string drawList, int startX, int startY, int endX, int endY)
575 { 492 {
576 if (!m_OSFunctionsEnabled)
577 {
578 OSSLError("osDrawLine: permission denied");
579 return String.Empty;
580 }
581
582 CheckThreatLevel(ThreatLevel.None, "osDrawLine"); 493 CheckThreatLevel(ThreatLevel.None, "osDrawLine");
583 494
584 m_host.AddScriptLPS(1); 495 m_host.AddScriptLPS(1);
@@ -588,12 +499,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
588 499
589 public string osDrawLine(string drawList, int endX, int endY) 500 public string osDrawLine(string drawList, int endX, int endY)
590 { 501 {
591 if (!m_OSFunctionsEnabled)
592 {
593 OSSLError("osDrawLine: permission denied");
594 return String.Empty;
595 }
596
597 CheckThreatLevel(ThreatLevel.None, "osDrawLine"); 502 CheckThreatLevel(ThreatLevel.None, "osDrawLine");
598 503
599 m_host.AddScriptLPS(1); 504 m_host.AddScriptLPS(1);
@@ -603,12 +508,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
603 508
604 public string osDrawText(string drawList, string text) 509 public string osDrawText(string drawList, string text)
605 { 510 {
606 if (!m_OSFunctionsEnabled)
607 {
608 OSSLError("osDrawText: permission denied");
609 return String.Empty;
610 }
611
612 CheckThreatLevel(ThreatLevel.None, "osDrawText"); 511 CheckThreatLevel(ThreatLevel.None, "osDrawText");
613 512
614 m_host.AddScriptLPS(1); 513 m_host.AddScriptLPS(1);
@@ -618,12 +517,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
618 517
619 public string osDrawEllipse(string drawList, int width, int height) 518 public string osDrawEllipse(string drawList, int width, int height)
620 { 519 {
621 if (!m_OSFunctionsEnabled)
622 {
623 OSSLError("osDrawEllipse: permission denied");
624 return String.Empty;
625 }
626
627 CheckThreatLevel(ThreatLevel.None, "osDrawEllipse"); 520 CheckThreatLevel(ThreatLevel.None, "osDrawEllipse");
628 521
629 m_host.AddScriptLPS(1); 522 m_host.AddScriptLPS(1);
@@ -633,12 +526,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
633 526
634 public string osDrawRectangle(string drawList, int width, int height) 527 public string osDrawRectangle(string drawList, int width, int height)
635 { 528 {
636 if (!m_OSFunctionsEnabled)
637 {
638 OSSLError("osDrawRectangle: permission denied");
639 return String.Empty;
640 }
641
642 CheckThreatLevel(ThreatLevel.None, "osDrawRectangle"); 529 CheckThreatLevel(ThreatLevel.None, "osDrawRectangle");
643 530
644 m_host.AddScriptLPS(1); 531 m_host.AddScriptLPS(1);
@@ -648,12 +535,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
648 535
649 public string osDrawFilledRectangle(string drawList, int width, int height) 536 public string osDrawFilledRectangle(string drawList, int width, int height)
650 { 537 {
651 if (!m_OSFunctionsEnabled)
652 {
653 OSSLError("osDrawFilledRectangle: permission denied");
654 return String.Empty;
655 }
656
657 CheckThreatLevel(ThreatLevel.None, "osDrawFilledRectangle"); 538 CheckThreatLevel(ThreatLevel.None, "osDrawFilledRectangle");
658 539
659 m_host.AddScriptLPS(1); 540 m_host.AddScriptLPS(1);
@@ -663,12 +544,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
663 544
664 public string osSetFontSize(string drawList, int fontSize) 545 public string osSetFontSize(string drawList, int fontSize)
665 { 546 {
666 if (!m_OSFunctionsEnabled)
667 {
668 OSSLError("osSetFontSize: permission denied");
669 return String.Empty;
670 }
671
672 CheckThreatLevel(ThreatLevel.None, "osSetFontSize"); 547 CheckThreatLevel(ThreatLevel.None, "osSetFontSize");
673 548
674 m_host.AddScriptLPS(1); 549 m_host.AddScriptLPS(1);
@@ -678,12 +553,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
678 553
679 public string osSetPenSize(string drawList, int penSize) 554 public string osSetPenSize(string drawList, int penSize)
680 { 555 {
681 if (!m_OSFunctionsEnabled)
682 {
683 OSSLError("osSetPenSize: permission denied");
684 return String.Empty;
685 }
686
687 CheckThreatLevel(ThreatLevel.None, "osSetPenSize"); 556 CheckThreatLevel(ThreatLevel.None, "osSetPenSize");
688 557
689 m_host.AddScriptLPS(1); 558 m_host.AddScriptLPS(1);
@@ -693,12 +562,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
693 562
694 public string osSetPenColour(string drawList, string colour) 563 public string osSetPenColour(string drawList, string colour)
695 { 564 {
696 if (!m_OSFunctionsEnabled)
697 {
698 OSSLError("osSetPenColour: permission denied");
699 return String.Empty;
700 }
701
702 CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); 565 CheckThreatLevel(ThreatLevel.None, "osSetPenColour");
703 566
704 m_host.AddScriptLPS(1); 567 m_host.AddScriptLPS(1);
@@ -708,12 +571,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
708 571
709 public string osDrawImage(string drawList, int width, int height, string imageUrl) 572 public string osDrawImage(string drawList, int width, int height, string imageUrl)
710 { 573 {
711 if (!m_OSFunctionsEnabled)
712 {
713 OSSLError("osDrawImage: permission denied");
714 return String.Empty;
715 }
716
717 CheckThreatLevel(ThreatLevel.None, "osDrawImage"); 574 CheckThreatLevel(ThreatLevel.None, "osDrawImage");
718 575
719 m_host.AddScriptLPS(1); 576 m_host.AddScriptLPS(1);
@@ -723,12 +580,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
723 580
724 public void osSetStateEvents(int events) 581 public void osSetStateEvents(int events)
725 { 582 {
726 if (!m_OSFunctionsEnabled)
727 {
728 OSSLError("osSetStateEvents: permission denied");
729 return;
730 }
731
732 // This function is a hack. There is no reason for it's existence 583 // This function is a hack. There is no reason for it's existence
733 // anymore, since state events now work properly. 584 // anymore, since state events now work properly.
734 // It was probably added as a crutch or debugging aid, and 585 // It was probably added as a crutch or debugging aid, and
@@ -741,12 +592,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
741 592
742 public void osSetRegionWaterHeight(double height) 593 public void osSetRegionWaterHeight(double height)
743 { 594 {
744 if (!m_OSFunctionsEnabled)
745 {
746 OSSLError("osSetRegionWaterHeight: permission denied");
747 return;
748 }
749
750 CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); 595 CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight");
751 596
752 m_host.AddScriptLPS(1); 597 m_host.AddScriptLPS(1);
@@ -760,12 +605,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
760 605
761 public double osList2Double(LSL_Types.list src, int index) 606 public double osList2Double(LSL_Types.list src, int index)
762 { 607 {
763 if (!m_OSFunctionsEnabled)
764 {
765 OSSLError("osList2Double: permission denied");
766 return 0.0;
767 }
768
769 // There is really no double type in OSSL. C# and other 608 // There is really no double type in OSSL. C# and other
770 // have one, but the current implementation of LSL_Types.list 609 // have one, but the current implementation of LSL_Types.list
771 // is not allowed to contain any. 610 // is not allowed to contain any.
@@ -787,12 +626,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
787 626
788 public void osSetParcelMediaURL(string url) 627 public void osSetParcelMediaURL(string url)
789 { 628 {
790 if (!m_OSFunctionsEnabled)
791 {
792 OSSLError("osSetParcelMediaURL: permission denied");
793 return;
794 }
795
796 // What actually is the difference to the LL function? 629 // What actually is the difference to the LL function?
797 // 630 //
798 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); 631 CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL");
@@ -815,12 +648,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
815 648
816 public string osGetScriptEngineName() 649 public string osGetScriptEngineName()
817 { 650 {
818 if (!m_OSFunctionsEnabled)
819 {
820 OSSLError("osGetScriptEngineName: permission denied");
821 return "";
822 }
823
824 // This gets a "high" because knowing the engine may be used 651 // This gets a "high" because knowing the engine may be used
825 // to exploit engine-specific bugs or induce usage patterns 652 // to exploit engine-specific bugs or induce usage patterns
826 // that trigger engine-specific failures. 653 // that trigger engine-specific failures.
@@ -856,12 +683,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
856 //for testing purposes only 683 //for testing purposes only
857 public void osSetParcelMediaTime(double time) 684 public void osSetParcelMediaTime(double time)
858 { 685 {
859 if (!m_OSFunctionsEnabled)
860 {
861 OSSLError("osSetParcelMediaTime: permission denied");
862 return;
863 }
864
865 // This gets very high because I have no idea what it does. 686 // This gets very high because I have no idea what it does.
866 // If someone knows, please adjust. If it;s no longer needed, 687 // If someone knows, please adjust. If it;s no longer needed,
867 // please remove. 688 // please remove.