diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
3 files changed, 49 insertions, 18 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 9042e0d..bf523dd 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -211,25 +211,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
211 | { | 211 | { |
212 | if (script.StartsWith("//MRM:C#")) | 212 | if (script.StartsWith("//MRM:C#")) |
213 | { | 213 | { |
214 | if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.MasterAvatarAssignedUUID | 214 | if (m_config.GetBoolean("OwnerOnly", true)) |
215 | || | 215 | if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.MasterAvatarAssignedUUID |
216 | m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.MasterAvatarAssignedUUID) | 216 | || m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.MasterAvatarAssignedUUID) |
217 | return; | 217 | return; |
218 | 218 | ||
219 | script = ConvertMRMKeywords(script); | 219 | script = ConvertMRMKeywords(script); |
220 | 220 | ||
221 | try | 221 | try |
222 | { | 222 | { |
223 | m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " + m_config.GetString("permissionLevel", "Internet") + "-level security."); | 223 | AppDomain target; |
224 | if (m_config.GetBoolean("Sandboxed", true)) | ||
225 | { | ||
226 | m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " + | ||
227 | m_config.GetString("SandboxLevel", "Internet") + "-level security."); | ||
224 | 228 | ||
225 | string domainName = UUID.Random().ToString(); | 229 | string domainName = UUID.Random().ToString(); |
226 | AppDomain target = CreateRestrictedDomain(m_config.GetString("permissionLevel", "Internet"), | 230 | target = CreateRestrictedDomain(m_config.GetString("SandboxLevel", "Internet"), |
227 | domainName); | 231 | domainName); |
232 | } | ||
233 | else | ||
234 | { | ||
235 | m_log.Info("[MRM] Found C# MRM - Starting in current AppDomain"); | ||
236 | m_log.Warn( | ||
237 | "[MRM] Security Risk: AppDomain is run in current context. Use only in trusted environments."); | ||
238 | target = AppDomain.CurrentDomain; | ||
239 | } | ||
228 | 240 | ||
241 | m_log.Info("[MRM] Unwrapping into target AppDomain"); | ||
229 | MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap( | 242 | MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap( |
230 | CompileFromDotNetText(script, itemID.ToString()), | 243 | CompileFromDotNetText(script, itemID.ToString()), |
231 | "OpenSim.MiniModule"); | 244 | "OpenSim.MiniModule"); |
232 | 245 | ||
246 | m_log.Info("[MRM] Initialising MRM Globals"); | ||
233 | InitializeMRM(mmb, localID, itemID); | 247 | InitializeMRM(mmb, localID, itemID); |
234 | 248 | ||
235 | m_scripts[itemID] = mmb; | 249 | m_scripts[itemID] = mmb; |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs index 68f2f52..0cba6af 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs | |||
@@ -91,24 +91,45 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
91 | public bool Bright | 91 | public bool Bright |
92 | { | 92 | { |
93 | get { return GetTexface().Fullbright; } | 93 | get { return GetTexface().Fullbright; } |
94 | set { throw new System.NotImplementedException(); } | 94 | set |
95 | { | ||
96 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
97 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
98 | texface.Fullbright = value; | ||
99 | tex.FaceTextures[m_face] = texface; | ||
100 | m_parent.UpdateTexture(tex); | ||
101 | } | ||
95 | } | 102 | } |
96 | 103 | ||
97 | public double Bloom | 104 | public double Bloom |
98 | { | 105 | { |
99 | get { return GetTexface().Glow; } | 106 | get { return GetTexface().Glow; } |
100 | set { throw new System.NotImplementedException(); } | 107 | set |
108 | { | ||
109 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
110 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
111 | texface.Glow = (float) value; | ||
112 | tex.FaceTextures[m_face] = texface; | ||
113 | m_parent.UpdateTexture(tex); | ||
114 | } | ||
101 | } | 115 | } |
102 | 116 | ||
103 | public bool Shiny | 117 | public bool Shiny |
104 | { | 118 | { |
105 | get { return GetTexface().Shiny != Shininess.None; } | 119 | get { return GetTexface().Shiny != Shininess.None; } |
106 | set { throw new System.NotImplementedException(); } | 120 | set |
121 | { | ||
122 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
123 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
124 | texface.Shiny = value ? Shininess.High : Shininess.None; | ||
125 | tex.FaceTextures[m_face] = texface; | ||
126 | m_parent.UpdateTexture(tex); | ||
127 | } | ||
107 | } | 128 | } |
108 | 129 | ||
109 | public bool BumpMap | 130 | public bool BumpMap |
110 | { | 131 | { |
111 | get { throw new System.NotImplementedException(); } | 132 | get { return GetTexface().Bump == Bumpiness.None; } |
112 | set { throw new System.NotImplementedException(); } | 133 | set { throw new System.NotImplementedException(); } |
113 | } | 134 | } |
114 | } | 135 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index 4600836..4427426 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | |||
@@ -25,17 +25,13 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Collections; | 28 | using System.Collections; |
31 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
32 | 30 | using System.Security; | |
33 | using OpenMetaverse; | 31 | using OpenMetaverse; |
34 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
36 | 34 | ||
37 | using log4net; | ||
38 | |||
39 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 35 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
40 | { | 36 | { |
41 | class SPAvatar : System.MarshalByRefObject, IAvatar | 37 | class SPAvatar : System.MarshalByRefObject, IAvatar |
@@ -60,7 +56,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
60 | public string Name | 56 | public string Name |
61 | { | 57 | { |
62 | get { return GetSP().Name; } | 58 | get { return GetSP().Name; } |
63 | set { throw new InvalidOperationException("Avatar Names are a read-only property."); } | 59 | set { throw new SecurityException("Avatar Names are a read-only property."); } |
64 | } | 60 | } |
65 | 61 | ||
66 | public UUID GlobalID | 62 | public UUID GlobalID |