aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2012-08-29 03:31:13 +0100
committerMelanie2012-08-29 03:31:13 +0100
commit899337b4a0584ce2371c3bfcc44387d0f090b792 (patch)
tree3a3e862951a85889c3c5762d6d30b5dd80868864 /OpenSim/Region/ScriptEngine
parentMerge branch 'master' into careminster (diff)
parentimplementing rule tracking (diff)
downloadopensim-SC_OLD-899337b4a0584ce2371c3bfcc44387d0f090b792.zip
opensim-SC_OLD-899337b4a0584ce2371c3bfcc44387d0f090b792.tar.gz
opensim-SC_OLD-899337b4a0584ce2371c3bfcc44387d0f090b792.tar.bz2
opensim-SC_OLD-899337b4a0584ce2371c3bfcc44387d0f090b792.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs46
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs59
4 files changed, 93 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5316d08..61e8a28 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7701,7 +7701,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7701 { 7701 {
7702 m_host.AddScriptLPS(1); 7702 m_host.AddScriptLPS(1);
7703 7703
7704 setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules); 7704 setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams");
7705 7705
7706 ScriptSleep(200); 7706 ScriptSleep(200);
7707 } 7707 }
@@ -7710,10 +7710,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7710 { 7710 {
7711 m_host.AddScriptLPS(1); 7711 m_host.AddScriptLPS(1);
7712 7712
7713 setLinkPrimParams(linknumber, rules); 7713 setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
7714
7715 ScriptSleep(200);
7714 } 7716 }
7715 7717
7716 private void setLinkPrimParams(int linknumber, LSL_List rules) 7718 private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
7717 { 7719 {
7718 List<object> parts = new List<object>(); 7720 List<object> parts = new List<object>();
7719 List<SceneObjectPart> prims = GetLinkParts(linknumber); 7721 List<SceneObjectPart> prims = GetLinkParts(linknumber);
@@ -7724,15 +7726,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7724 parts.Add(p); 7726 parts.Add(p);
7725 7727
7726 LSL_List remaining = null; 7728 LSL_List remaining = null;
7729 uint rulesParsed = 0;
7727 7730
7728 if (parts.Count > 0) 7731 if (parts.Count > 0)
7729 { 7732 {
7730 foreach (object part in parts) 7733 foreach (object part in parts)
7731 { 7734 {
7732 if (part is SceneObjectPart) 7735 if (part is SceneObjectPart)
7733 remaining = SetPrimParams((SceneObjectPart)part, rules); 7736 remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
7734 else 7737 else
7735 remaining = SetPrimParams((ScenePresence)part, rules); 7738 remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
7736 } 7739 }
7737 7740
7738 while ((object)remaining != null && remaining.Length > 2) 7741 while ((object)remaining != null && remaining.Length > 2)
@@ -7750,9 +7753,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7750 foreach (object part in parts) 7753 foreach (object part in parts)
7751 { 7754 {
7752 if (part is SceneObjectPart) 7755 if (part is SceneObjectPart)
7753 remaining = SetPrimParams((SceneObjectPart)part, rules); 7756 remaining = SetPrimParams((SceneObjectPart)part, rules, originFunc, ref rulesParsed);
7754 else 7757 else
7755 remaining = SetPrimParams((ScenePresence)part, rules); 7758 remaining = SetPrimParams((ScenePresence)part, rules, originFunc, ref rulesParsed);
7756 } 7759 }
7757 } 7760 }
7758 } 7761 }
@@ -7790,6 +7793,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7790 7793
7791 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules) 7794 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
7792 { 7795 {
7796 setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams");
7793 llSetLinkPrimitiveParamsFast(linknumber, rules); 7797 llSetLinkPrimitiveParamsFast(linknumber, rules);
7794 ScriptSleep(200); 7798 ScriptSleep(200);
7795 } 7799 }
@@ -7817,12 +7821,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7817 return new Vector3((float)x, (float)y, (float)z); 7821 return new Vector3((float)x, (float)y, (float)z);
7818 } 7822 }
7819 7823
7820 protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules) 7824 protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules, string originFunc, ref uint rulesParsed)
7821 { 7825 {
7822 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 7826 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
7823 return null; 7827 return null;
7824 7828
7825 int idx = 0; 7829 int idx = 0;
7830 int idxStart = 0;
7826 7831
7827 SceneObjectGroup parentgrp = part.ParentGroup; 7832 SceneObjectGroup parentgrp = part.ParentGroup;
7828 7833
@@ -7833,9 +7838,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7833 { 7838 {
7834 while (idx < rules.Length) 7839 while (idx < rules.Length)
7835 { 7840 {
7841 ++rulesParsed;
7836 int code = rules.GetLSLIntegerItem(idx++); 7842 int code = rules.GetLSLIntegerItem(idx++);
7837 7843
7838 int remain = rules.Length - idx; 7844 int remain = rules.Length - idx;
7845 idxStart = idx;
7839 7846
7840 int face; 7847 int face;
7841 LSL_Vector v; 7848 LSL_Vector v;
@@ -8243,7 +8250,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8243 } 8250 }
8244 catch (InvalidCastException e) 8251 catch (InvalidCastException e)
8245 { 8252 {
8246 ShoutError(e.Message); 8253 ShoutError(string.Format(
8254 "{0} error running rule #{1}: arg #{2} ",
8255 originFunc, rulesParsed, idx - idxStart) + e.Message);
8247 } 8256 }
8248 finally 8257 finally
8249 { 8258 {
@@ -11660,7 +11669,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11660 return tid.ToString(); 11669 return tid.ToString();
11661 } 11670 }
11662 11671
11663 public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) 11672 public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc)
11664 { 11673 {
11665 SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); 11674 SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim));
11666 if (obj == null) 11675 if (obj == null)
@@ -11669,14 +11678,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11669 if (obj.OwnerID != m_host.OwnerID) 11678 if (obj.OwnerID != m_host.OwnerID)
11670 return; 11679 return;
11671 11680
11672 LSL_List remaining = SetPrimParams(obj, rules); 11681 uint rulesParsed = 0;
11682 LSL_List remaining = SetPrimParams(obj, rules, originFunc, ref rulesParsed);
11673 11683
11674 while ((object)remaining != null && remaining.Length > 2) 11684 while ((object)remaining != null && remaining.Length > 2)
11675 { 11685 {
11676 LSL_Integer newLink = remaining.GetLSLIntegerItem(0); 11686 LSL_Integer newLink = remaining.GetLSLIntegerItem(0);
11677 LSL_List newrules = remaining.GetSublist(1, -1); 11687 LSL_List newrules = remaining.GetSublist(1, -1);
11678 foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){ 11688 foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){
11679 remaining = SetPrimParams(part, newrules); 11689 remaining = SetPrimParams(part, newrules, originFunc, ref rulesParsed);
11680 } 11690 }
11681 } 11691 }
11682 } 11692 }
@@ -12640,11 +12650,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12640 } 12650 }
12641 } 12651 }
12642 12652
12643 protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules) 12653 protected LSL_List SetPrimParams(ScenePresence av, LSL_List rules, string originFunc, ref uint rulesParsed)
12644 { 12654 {
12645 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. 12655 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
12646 12656
12647 int idx = 0; 12657 int idx = 0;
12658 int idxStart = 0;
12648 12659
12649 bool positionChanged = false; 12660 bool positionChanged = false;
12650 Vector3 finalPos = Vector3.Zero; 12661 Vector3 finalPos = Vector3.Zero;
@@ -12653,9 +12664,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12653 { 12664 {
12654 while (idx < rules.Length) 12665 while (idx < rules.Length)
12655 { 12666 {
12667 ++rulesParsed;
12656 int code = rules.GetLSLIntegerItem(idx++); 12668 int code = rules.GetLSLIntegerItem(idx++);
12657 12669
12658 int remain = rules.Length - idx; 12670 int remain = rules.Length - idx;
12671 idxStart = idx;
12659 12672
12660 switch (code) 12673 switch (code)
12661 { 12674 {
@@ -12809,7 +12822,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12809 } 12822 }
12810 } 12823 }
12811 } 12824 }
12812 12825 catch (InvalidCastException e)
12826 {
12827 ShoutError(string.Format(
12828 "{0} error running rule #{1}: arg #{2} ",
12829 originFunc, rulesParsed, idx - idxStart) + e.Message);
12830 }
12813 finally 12831 finally
12814 { 12832 {
12815 if (positionChanged) 12833 if (positionChanged)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 5bc78d6..ceff889 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3036,7 +3036,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3036 m_host.AddScriptLPS(1); 3036 m_host.AddScriptLPS(1);
3037 InitLSL(); 3037 InitLSL();
3038 3038
3039 m_LSL_Api.SetPrimitiveParamsEx(prim, rules); 3039 m_LSL_Api.SetPrimitiveParamsEx(prim, rules, "osSetPrimitiveParams");
3040 } 3040 }
3041 3041
3042 /// <summary> 3042 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index e08328f..05c20f9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -429,7 +429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
429 LSL_Integer llGetLinkNumberOfSides(LSL_Integer link); 429 LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
430 void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density); 430 void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density);
431 431
432 void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); 432 void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc);
433 void llSetKeyframedMotion(LSL_List frames, LSL_List options); 433 void llSetKeyframedMotion(LSL_List frames, LSL_List options);
434 LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); 434 LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
435 } 435 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 8101da5..d0e041c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -40,16 +40,75 @@ using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
40 40
41namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces 41namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
42{ 42{
43 /// <summary>
44 /// To permit region owners to enable the extended scripting functionality
45 /// of OSSL, without allowing malicious scripts to access potentially
46 /// troublesome functions, each OSSL function is assigned a threat level,
47 /// and access to the functions is granted or denied based on a default
48 /// threshold set in OpenSim.ini (which can be overridden for individual
49 /// functions on a case-by-case basis)
50 /// </summary>
43 public enum ThreatLevel 51 public enum ThreatLevel
44 { 52 {
53 // Not documented, presumably means permanently disabled ?
45 NoAccess = -1, 54 NoAccess = -1,
55
56 /// <summary>
57 /// Function is no threat at all. It doesn't constitute a threat to
58 /// either users or the system and has no known side effects.
59 /// </summary>
46 None = 0, 60 None = 0,
61
62 /// <summary>
63 /// Abuse of this command can cause a nuisance to the region operator,
64 /// such as log message spew.
65 /// </summary>
47 Nuisance = 1, 66 Nuisance = 1,
67
68 /// <summary>
69 /// Extreme levels of abuse of this function can cause impaired
70 /// functioning of the region, or very gullible users can be tricked
71 /// into experiencing harmless effects.
72 /// </summary>
48 VeryLow = 2, 73 VeryLow = 2,
74
75 /// <summary>
76 /// Intentional abuse can cause crashes or malfunction under certain
77 /// circumstances, which can be easily rectified; or certain users can
78 /// be tricked into certain situations in an avoidable manner.
79 /// </summary>
49 Low = 3, 80 Low = 3,
81
82 /// <summary>
83 /// Intentional abuse can cause denial of service and crashes with
84 /// potential of data or state loss; or trusting users can be tricked
85 /// into embarrassing or uncomfortable situations.
86 /// </summary>
50 Moderate = 4, 87 Moderate = 4,
88
89 /// <summary>
90 /// Casual abuse can cause impaired functionality or temporary denial
91 /// of service conditions. Intentional abuse can easily cause crashes
92 /// with potential data loss, or can be used to trick experienced and
93 /// cautious users into unwanted situations, or changes global data
94 /// permanently and without undo ability.
95 /// </summary>
51 High = 5, 96 High = 5,
97
98 /// <summary>
99 /// Even normal use may, depending on the number of instances, or
100 /// frequency of use, result in severe service impairment or crash
101 /// with loss of data, or can be used to cause unwanted or harmful
102 /// effects on users without giving the user a means to avoid it.
103 /// </summary>
52 VeryHigh = 6, 104 VeryHigh = 6,
105
106 /// <summary>
107 /// Even casual use is a danger to region stability, or function allows
108 /// console or OS command execution, or function allows taking money
109 /// without consent, or allows deletion or modification of user data,
110 /// or allows the compromise of sensitive data by design.
111 /// </summary>
53 Severe = 7 112 Severe = 7
54 }; 113 };
55 114