aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2009-08-17 05:55:38 -0700
committerDiva Canto2009-08-17 05:55:38 -0700
commitfa8a94577a2f38145da0c8a1f6d1c72c4f339ed9 (patch)
tree7bee741b06e6732fae848bef3c6b7f808ab3349a /OpenSim/Region
parentBumped up grid services interface number. (diff)
parentAdd System.Xml reference to the console project (diff)
downloadopensim-SC_OLD-fa8a94577a2f38145da0c8a1f6d1c72c4f339ed9.zip
opensim-SC_OLD-fa8a94577a2f38145da0c8a1f6d1c72c4f339ed9.tar.gz
opensim-SC_OLD-fa8a94577a2f38145da0c8a1f6d1c72c4f339ed9.tar.bz2
opensim-SC_OLD-fa8a94577a2f38145da0c8a1f6d1c72c4f339ed9.tar.xz
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/Application.cs3
-rw-r--r--OpenSim/Region/Application/OpenSim.cs26
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs77
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs1
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs27
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs103
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs16
15 files changed, 277 insertions, 42 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index df80290..2fd26bf 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -120,6 +120,7 @@ namespace OpenSim
120 configSource.AddSwitch("Startup", "gridmode"); 120 configSource.AddSwitch("Startup", "gridmode");
121 configSource.AddSwitch("Startup", "physics"); 121 configSource.AddSwitch("Startup", "physics");
122 configSource.AddSwitch("Startup", "gui"); 122 configSource.AddSwitch("Startup", "gui");
123 configSource.AddSwitch("Startup", "console");
123 124
124 configSource.AddConfig("StandAlone"); 125 configSource.AddConfig("StandAlone");
125 configSource.AddConfig("Network"); 126 configSource.AddConfig("Network");
@@ -223,4 +224,4 @@ namespace OpenSim
223 _IsHandlingException = false; 224 _IsHandlingException = false;
224 } 225 }
225 } 226 }
226} \ No newline at end of file 227}
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 390cfcd..38874f9 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -52,6 +52,7 @@ namespace OpenSim
52 protected string m_startupCommandsFile; 52 protected string m_startupCommandsFile;
53 protected string m_shutdownCommandsFile; 53 protected string m_shutdownCommandsFile;
54 protected bool m_gui = false; 54 protected bool m_gui = false;
55 protected string m_consoleType = "local";
55 56
56 private string m_timedScript = "disabled"; 57 private string m_timedScript = "disabled";
57 private Timer m_scriptTimer; 58 private Timer m_scriptTimer;
@@ -71,7 +72,10 @@ namespace OpenSim
71 m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", "startup_commands.txt"); 72 m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", "startup_commands.txt");
72 m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", "shutdown_commands.txt"); 73 m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", "shutdown_commands.txt");
73 74
74 m_gui = startupConfig.GetBoolean("gui", false); 75 if (startupConfig.GetString("console", String.Empty) == String.Empty)
76 m_gui = startupConfig.GetBoolean("gui", false);
77 else
78 m_consoleType= startupConfig.GetString("console", String.Empty);
75 79
76 m_timedScript = startupConfig.GetString("timer_Script", "disabled"); 80 m_timedScript = startupConfig.GetString("timer_Script", "disabled");
77 if (m_logFileAppender != null) 81 if (m_logFileAppender != null)
@@ -110,13 +114,31 @@ namespace OpenSim
110 if (m_gui) // Driven by external GUI 114 if (m_gui) // Driven by external GUI
111 m_console = new CommandConsole("Region"); 115 m_console = new CommandConsole("Region");
112 else 116 else
113 m_console = new LocalConsole("Region"); 117 {
118 switch (m_consoleType)
119 {
120 case "basic":
121 m_console = new CommandConsole("Region");
122 break;
123 case "rest":
124 m_console = new RemoteConsole("Region");
125 ((RemoteConsole)m_console).ReadConfig(m_config.Source);
126 break;
127 default:
128 m_console = new LocalConsole("Region");
129 break;
130 }
131 }
132
114 MainConsole.Instance = m_console; 133 MainConsole.Instance = m_console;
115 134
116 RegisterConsoleCommands(); 135 RegisterConsoleCommands();
117 136
118 base.StartupSpecific(); 137 base.StartupSpecific();
119 138
139 if (m_console is RemoteConsole)
140 ((RemoteConsole)m_console).SetServer(m_httpServer);
141
120 //Run Startup Commands 142 //Run Startup Commands
121 if (String.IsNullOrEmpty(m_startupCommandsFile)) 143 if (String.IsNullOrEmpty(m_startupCommandsFile))
122 { 144 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 06bea3d..9aef26d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1435,6 +1435,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1435 /// <param name="map">heightmap</param> 1435 /// <param name="map">heightmap</param>
1436 public virtual void SendLayerData(float[] map) 1436 public virtual void SendLayerData(float[] map)
1437 { 1437 {
1438 DoSendLayerData((object)map);
1438 ThreadPool.QueueUserWorkItem(DoSendLayerData, map); 1439 ThreadPool.QueueUserWorkItem(DoSendLayerData, map);
1439 } 1440 }
1440 1441
@@ -1450,16 +1451,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1450 { 1451 {
1451 for (int y = 0; y < 16; y++) 1452 for (int y = 0; y < 16; y++)
1452 { 1453 {
1453 // For some terrains, sending more than one terrain patch at once results in a libsecondlife exception 1454 for (int x = 0; x < 16; x += 4)
1454 // see http://opensimulator.org/mantis/view.php?id=1662 1455 {
1455 //for (int x = 0; x < 16; x += 4) 1456 SendLayerPacket(LLHeightFieldMoronize(map), y, x);
1456 //{
1457 // SendLayerPacket(map, y, x);
1458 // Thread.Sleep(150);
1459 //}
1460 for (int x = 0; x < 16; x++)
1461 {
1462 SendLayerData(x, y, LLHeightFieldMoronize(map));
1463 Thread.Sleep(35); 1457 Thread.Sleep(35);
1464 } 1458 }
1465 } 1459 }
@@ -1476,17 +1470,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1476 /// <param name="map">heightmap</param> 1470 /// <param name="map">heightmap</param>
1477 /// <param name="px">X coordinate for patches 0..12</param> 1471 /// <param name="px">X coordinate for patches 0..12</param>
1478 /// <param name="py">Y coordinate for patches 0..15</param> 1472 /// <param name="py">Y coordinate for patches 0..15</param>
1479 // private void SendLayerPacket(float[] map, int y, int x) 1473 private void SendLayerPacket(float[] map, int y, int x)
1480 // { 1474 {
1481 // int[] patches = new int[4]; 1475 int[] patches = new int[4];
1482 // patches[0] = x + 0 + y * 16; 1476 patches[0] = x + 0 + y * 16;
1483 // patches[1] = x + 1 + y * 16; 1477 patches[1] = x + 1 + y * 16;
1484 // patches[2] = x + 2 + y * 16; 1478 patches[2] = x + 2 + y * 16;
1485 // patches[3] = x + 3 + y * 16; 1479 patches[3] = x + 3 + y * 16;
1486 1480
1487 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1481 LayerDataPacket layerpack;
1488 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1482 try
1489 // } 1483 {
1484 layerpack = TerrainCompressor.CreateLandPacket(map, patches);
1485 layerpack.Header.Zerocoded = true;
1486 layerpack.Header.Reliable = true;
1487
1488 if (layerpack.Length > 1000) // Oversize packet was created
1489 {
1490 for (int xa = 0 ; xa < 4 ; xa++)
1491 {
1492 // Send oversize packet in individual patches
1493 //
1494 SendLayerData(x+xa, y, map);
1495 }
1496 }
1497 else
1498 {
1499 OutPacket(layerpack, ThrottleOutPacketType.Land);
1500 }
1501 }
1502 catch (OverflowException e)
1503 {
1504 for (int xa = 0 ; xa < 4 ; xa++)
1505 {
1506 // Send oversize packet in individual patches
1507 //
1508 SendLayerData(x+xa, y, map);
1509 }
1510 }
1511 catch (IndexOutOfRangeException e)
1512 {
1513 for (int xa = 0 ; xa < 4 ; xa++)
1514 {
1515 // Bad terrain, send individual chunks
1516 //
1517 SendLayerData(x+xa, y, map);
1518 }
1519 }
1520 }
1490 1521
1491 /// <summary> 1522 /// <summary>
1492 /// Sends a specified patch to a client 1523 /// Sends a specified patch to a client
@@ -1507,6 +1538,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1507 1538
1508 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(((map.Length==65536)? map : LLHeightFieldMoronize(map)), patches); 1539 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(((map.Length==65536)? map : LLHeightFieldMoronize(map)), patches);
1509 layerpack.Header.Zerocoded = true; 1540 layerpack.Header.Zerocoded = true;
1541 layerpack.Header.Reliable = true;
1510 1542
1511 OutPacket(layerpack, ThrottleOutPacketType.Land); 1543 OutPacket(layerpack, ThrottleOutPacketType.Land);
1512 1544
@@ -1556,7 +1588,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1556 /// <param name="windSpeeds">16x16 array of wind speeds</param> 1588 /// <param name="windSpeeds">16x16 array of wind speeds</param>
1557 public virtual void SendWindData(Vector2[] windSpeeds) 1589 public virtual void SendWindData(Vector2[] windSpeeds)
1558 { 1590 {
1559 ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds); 1591 DoSendWindData((object)windSpeeds);
1592 // ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds);
1560 } 1593 }
1561 1594
1562 /// <summary> 1595 /// <summary>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
index bd11d97..9fb1041 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
@@ -34,6 +34,7 @@ using OpenMetaverse;
34using OpenMetaverse.Packets; 34using OpenMetaverse.Packets;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
37 38
38namespace OpenSim.Region.ClientStack.LindenUDP.Tests 39namespace OpenSim.Region.ClientStack.LindenUDP.Tests
39{ 40{
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index aef1b94..47c7fe4 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Communications.OGS1
147 { 147 {
148 // The timeout should always be significantly larger than the timeout for the grid server to request 148 // The timeout should always be significantly larger than the timeout for the grid server to request
149 // the initial status of the region before confirming registration. 149 // the initial status of the region before confirming registration.
150 GridResp = GridReq.Send(serversInfo.GridURL, 90000); 150 GridResp = GridReq.Send(serversInfo.GridURL, 9999999);
151 } 151 }
152 catch (Exception e) 152 catch (Exception e)
153 { 153 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index fcc2673..2426393 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
48 private int m_saydistance = 30; 48 private int m_saydistance = 30;
49 private int m_shoutdistance = 100; 49 private int m_shoutdistance = 100;
50 private int m_whisperdistance = 10; 50 private int m_whisperdistance = 10;
51 private string m_adminprefix = String.Empty;
51 private List<Scene> m_scenes = new List<Scene>(); 52 private List<Scene> m_scenes = new List<Scene>();
52 53
53 internal object m_syncy = new object(); 54 internal object m_syncy = new object();
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
76 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); 77 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
77 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); 78 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
78 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); 79 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
80 m_adminprefix = config.Configs["Chat"].GetString("admin_prefix", m_adminprefix);
79 } 81 }
80 82
81 public virtual void AddRegion(Scene scene) 83 public virtual void AddRegion(Scene scene)
@@ -207,6 +209,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
207 fromPos = avatar.AbsolutePosition; 209 fromPos = avatar.AbsolutePosition;
208 fromName = avatar.Name; 210 fromName = avatar.Name;
209 fromID = c.Sender.AgentId; 211 fromID = c.Sender.AgentId;
212 if (avatar.GodLevel > 100)
213 fromName = m_adminprefix + fromName;
210 214
211 break; 215 break;
212 216
@@ -255,14 +259,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
255 string fromName = c.From; 259 string fromName = c.From;
256 260
257 UUID fromID = UUID.Zero; 261 UUID fromID = UUID.Zero;
262 UUID ownerID = UUID.Zero;
258 ChatSourceType sourceType = ChatSourceType.Object; 263 ChatSourceType sourceType = ChatSourceType.Object;
259 if (null != c.Sender) 264 if (null != c.Sender)
260 { 265 {
261 ScenePresence avatar = (c.Scene as Scene).GetScenePresence(c.Sender.AgentId); 266 ScenePresence avatar = (c.Scene as Scene).GetScenePresence(c.Sender.AgentId);
262 fromID = c.Sender.AgentId; 267 fromID = c.Sender.AgentId;
268 ownerID = c.Sender.AgentId;
263 fromName = avatar.Name; 269 fromName = avatar.Name;
264 sourceType = ChatSourceType.Agent; 270 sourceType = ChatSourceType.Agent;
265 } 271 }
272 if (c.SenderObject != null)
273 {
274 SceneObjectPart senderObject = (SceneObjectPart)c.SenderObject;
275 fromID = senderObject.UUID;
276 ownerID = senderObject.OwnerID;
277 fromName = senderObject.Name;
278 }
266 279
267 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 280 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
268 281
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index 20671e0..bce160a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -123,7 +123,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
123 123
124 public LandData GetLandData(ulong regionHandle, uint x, uint y) 124 public LandData GetLandData(ulong regionHandle, uint x, uint y)
125 { 125 {
126 m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {2}", 126 m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}",
127 regionHandle, m_Scenes.Count); 127 regionHandle, m_Scenes.Count);
128 foreach (Scene s in m_Scenes) 128 foreach (Scene s in m_Scenes)
129 { 129 {
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 75b3fe6..61ef20e 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -214,7 +214,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
214 214
215 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) 215 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
216 { 216 {
217 m_scene.Restart(timeInSeconds); 217// m_scene.Restart(timeInSeconds);
218 remoteClient.SendBlueBoxMessage(UUID.Zero, "System", "Restart is not available");
218 } 219 }
219 220
220 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) 221 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 3dfe4fe..2bf4ea8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -115,7 +115,6 @@ namespace OpenSim.Region.Framework.Scenes
115 /// <param name="remoteClient"></param> 115 /// <param name="remoteClient"></param>
116 public void RequestPrim(uint primLocalID, IClientAPI remoteClient) 116 public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
117 { 117 {
118 PacketType i = PacketType.ObjectUpdate;
119 List<EntityBase> EntityList = GetEntities(); 118 List<EntityBase> EntityList = GetEntities();
120 119
121 foreach (EntityBase ent in EntityList) 120 foreach (EntityBase ent in EntityList)
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs
index 22b4605..1993948 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs
@@ -1,3 +1,30 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
1namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 28namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
2{ 29{
3 public interface IAvatarAttachment 30 public interface IAvatarAttachment
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 6daae29..9042e0d 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -27,9 +27,14 @@
27 27
28using System; 28using System;
29using System.CodeDom.Compiler; 29using System.CodeDom.Compiler;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Diagnostics;
31using System.IO; 33using System.IO;
32using System.Reflection; 34using System.Reflection;
35using System.Security;
36using System.Security.Permissions;
37using System.Security.Policy;
33using System.Text; 38using System.Text;
34using log4net; 39using log4net;
35using Microsoft.CSharp; 40using Microsoft.CSharp;
@@ -54,6 +59,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
54 59
55 private readonly MicroScheduler m_microthreads = new MicroScheduler(); 60 private readonly MicroScheduler m_microthreads = new MicroScheduler();
56 61
62
63 private IConfig m_config;
64
57 public void RegisterExtension<T>(T instance) 65 public void RegisterExtension<T>(T instance)
58 { 66 {
59 m_extensions[typeof (T)] = instance; 67 m_extensions[typeof (T)] = instance;
@@ -63,6 +71,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
63 { 71 {
64 if (source.Configs["MRM"] != null) 72 if (source.Configs["MRM"] != null)
65 { 73 {
74 m_config = source.Configs["MRM"];
75
66 if (source.Configs["MRM"].GetBoolean("Enabled", false)) 76 if (source.Configs["MRM"].GetBoolean("Enabled", false))
67 { 77 {
68 m_log.Info("[MRM] Enabling MRM Module"); 78 m_log.Info("[MRM] Enabling MRM Module");
@@ -112,6 +122,91 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
112 return script; 122 return script;
113 } 123 }
114 124
125 /// <summary>
126 /// Create an AppDomain that contains policy restricting code to execute
127 /// with only the permissions granted by a named permission set
128 /// </summary>
129 /// <param name="permissionSetName">name of the permission set to restrict to</param>
130 /// <param name="appDomainName">'friendly' name of the appdomain to be created</param>
131 /// <exception cref="ArgumentNullException">
132 /// if <paramref name="permissionSetName"/> is null
133 /// </exception>
134 /// <exception cref="ArgumentOutOfRangeException">
135 /// if <paramref name="permissionSetName"/> is empty
136 /// </exception>
137 /// <returns>AppDomain with a restricted security policy</returns>
138 /// <remarks>Substantial portions of this function from: http://blogs.msdn.com/shawnfa/archive/2004/10/25/247379.aspx
139 /// Valid permissionSetName values are:
140 /// * FullTrust
141 /// * SkipVerification
142 /// * Execution
143 /// * Nothing
144 /// * LocalIntranet
145 /// * Internet
146 /// * Everything
147 /// </remarks>
148 public static AppDomain CreateRestrictedDomain(string permissionSetName, string appDomainName)
149 {
150 if (permissionSetName == null)
151 throw new ArgumentNullException("permissionSetName");
152 if (permissionSetName.Length == 0)
153 throw new ArgumentOutOfRangeException("permissionSetName", permissionSetName,
154 "Cannot have an empty permission set name");
155
156 // Default to all code getting nothing
157 PolicyStatement emptyPolicy = new PolicyStatement(new PermissionSet(PermissionState.None));
158 UnionCodeGroup policyRoot = new UnionCodeGroup(new AllMembershipCondition(), emptyPolicy);
159
160 bool foundName = false;
161 PermissionSet setIntersection = new PermissionSet(PermissionState.Unrestricted);
162
163 // iterate over each policy level
164 IEnumerator levelEnumerator = SecurityManager.PolicyHierarchy();
165 while (levelEnumerator.MoveNext())
166 {
167 PolicyLevel level = levelEnumerator.Current as PolicyLevel;
168
169 // if this level has defined a named permission set with the
170 // given name, then intersect it with what we've retrieved
171 // from all the previous levels
172 if (level != null)
173 {
174 PermissionSet levelSet = level.GetNamedPermissionSet(permissionSetName);
175 if (levelSet != null)
176 {
177 foundName = true;
178 if (setIntersection != null)
179 setIntersection = setIntersection.Intersect(levelSet);
180 }
181 }
182 }
183
184 // Intersect() can return null for an empty set, so convert that
185 // to an empty set object. Also return an empty set if we didn't find
186 // the named permission set we were looking for
187 if (setIntersection == null || !foundName)
188 setIntersection = new PermissionSet(PermissionState.None);
189 else
190 setIntersection = new NamedPermissionSet(permissionSetName, setIntersection);
191
192 // if no named permission sets were found, return an empty set,
193 // otherwise return the set that was found
194 PolicyStatement permissions = new PolicyStatement(setIntersection);
195 policyRoot.AddChild(new UnionCodeGroup(new AllMembershipCondition(), permissions));
196
197 // create an AppDomain policy level for the policy tree
198 PolicyLevel appDomainLevel = PolicyLevel.CreateAppDomainLevel();
199 appDomainLevel.RootCodeGroup = policyRoot;
200
201 // create an AppDomain where this policy will be in effect
202 string domainName = appDomainName;
203 AppDomain restrictedDomain = AppDomain.CreateDomain(domainName);
204 restrictedDomain.SetAppDomainPolicy(appDomainLevel);
205
206 return restrictedDomain;
207 }
208
209
115 void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) 210 void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
116 { 211 {
117 if (script.StartsWith("//MRM:C#")) 212 if (script.StartsWith("//MRM:C#"))
@@ -125,9 +220,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
125 220
126 try 221 try
127 { 222 {
128 m_log.Info("[MRM] Found C# MRM"); 223 m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " + m_config.GetString("permissionLevel", "Internet") + "-level security.");
224
225 string domainName = UUID.Random().ToString();
226 AppDomain target = CreateRestrictedDomain(m_config.GetString("permissionLevel", "Internet"),
227 domainName);
129 228
130 MRMBase mmb = (MRMBase)AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap( 229 MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap(
131 CompileFromDotNetText(script, itemID.ToString()), 230 CompileFromDotNetText(script, itemID.ToString()),
132 "OpenSim.MiniModule"); 231 "OpenSim.MiniModule");
133 232
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 35b0a0f..292e345 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
71 71
72 private bool CanEdit() 72 private bool CanEdit()
73 { 73 {
74 if(!m_security.CanEditObject(this)) 74 if (!m_security.CanEditObject(this))
75 { 75 {
76 throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]"); 76 throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]");
77 } 77 }
@@ -672,7 +672,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
672 get { return m_sculptType; } 672 get { return m_sculptType; }
673 set 673 set
674 { 674 {
675 if(!CanEdit()) 675 if (!CanEdit())
676 return; 676 return;
677 677
678 m_sculptType = value; 678 m_sculptType = value;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index b7030f1..80d7598 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -156,10 +156,10 @@ namespace OpenSim.Region.Physics.OdePlugin
156 156
157 private const uint m_regionWidth = Constants.RegionSize; 157 private const uint m_regionWidth = Constants.RegionSize;
158 private const uint m_regionHeight = Constants.RegionSize; 158 private const uint m_regionHeight = Constants.RegionSize;
159 159 private bool IsLocked = false;
160 private float ODE_STEPSIZE = 0.020f; 160 private float ODE_STEPSIZE = 0.020f;
161 private float metersInSpace = 29.9f; 161 private float metersInSpace = 29.9f;
162 162 private List<PhysicsActor> RemoveQueue;
163 public float gravityx = 0f; 163 public float gravityx = 0f;
164 public float gravityy = 0f; 164 public float gravityy = 0f;
165 public float gravityz = -9.8f; 165 public float gravityz = -9.8f;
@@ -376,6 +376,7 @@ namespace OpenSim.Region.Physics.OdePlugin
376 // Initialize the mesh plugin 376 // Initialize the mesh plugin
377 public override void Initialise(IMesher meshmerizer, IConfigSource config) 377 public override void Initialise(IMesher meshmerizer, IConfigSource config)
378 { 378 {
379 RemoveQueue = new List<PhysicsActor>();
379 mesher = meshmerizer; 380 mesher = meshmerizer;
380 m_config = config; 381 m_config = config;
381 // Defaults 382 // Defaults
@@ -2047,13 +2048,21 @@ namespace OpenSim.Region.Physics.OdePlugin
2047 { 2048 {
2048 if (prim is OdePrim) 2049 if (prim is OdePrim)
2049 { 2050 {
2050 lock (OdeLock) 2051 if (!IsLocked) //Fix a deadlock situation.. have we been locked by Simulate?
2051 { 2052 {
2052 OdePrim p = (OdePrim) prim; 2053 lock (OdeLock)
2054 {
2055 OdePrim p = (OdePrim)prim;
2053 2056
2054 p.setPrimForRemoval(); 2057 p.setPrimForRemoval();
2055 AddPhysicsActorTaint(prim); 2058 AddPhysicsActorTaint(prim);
2056 //RemovePrimThreadLocked(p); 2059 //RemovePrimThreadLocked(p);
2060 }
2061 }
2062 else
2063 {
2064 //Add the prim to a queue which will be removed when Simulate has finished what it's doing.
2065 RemoveQueue.Add(prim);
2057 } 2066 }
2058 } 2067 }
2059 } 2068 }
@@ -2575,7 +2584,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2575 DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks 2584 DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2576 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks 2585 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2577 } 2586 }
2578 2587 IsLocked = true;
2579 lock (OdeLock) 2588 lock (OdeLock)
2580 { 2589 {
2581 // Process 10 frames if the sim is running normal.. 2590 // Process 10 frames if the sim is running normal..
@@ -2988,6 +2997,19 @@ namespace OpenSim.Region.Physics.OdePlugin
2988 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); 2997 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
2989 } 2998 }
2990 } 2999 }
3000 IsLocked = false;
3001 if (RemoveQueue.Count > 0)
3002 {
3003 do
3004 {
3005 if (RemoveQueue[0] != null)
3006 {
3007 RemovePrimThreadLocked((OdePrim)RemoveQueue[0]);
3008 }
3009 RemoveQueue.RemoveAt(0);
3010 }
3011 while (RemoveQueue.Count > 0);
3012 }
2991 3013
2992 return fps; 3014 return fps;
2993 } 3015 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index f290dd7..358ce22 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -35,6 +35,7 @@ using Nini.Config;
35using OpenSim.Region.ScriptEngine.Shared.Api; 35using OpenSim.Region.ScriptEngine.Shared.Api;
36using OpenMetaverse; 36using OpenMetaverse;
37using System; 37using System;
38using OpenSim.Tests.Common.Mock;
38 39
39namespace OpenSim.Region.ScriptEngine.Shared.Tests 40namespace OpenSim.Region.ScriptEngine.Shared.Tests
40{ 41{
@@ -52,7 +53,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
52 public void SetUp() 53 public void SetUp()
53 { 54 {
54 55
55 IniConfigSource initConfigSource = new IniConfigSource(); 56 IConfigSource initConfigSource = new IniConfigSource();
56 IConfig config = initConfigSource.AddConfig("XEngine"); 57 IConfig config = initConfigSource.AddConfig("XEngine");
57 config.Set("Enabled", "true"); 58 config.Set("Enabled", "true");
58 59
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 7142c8c..8195f33 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -70,6 +70,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
70 } 70 }
71 } 71 }
72 72
73 /// <summary>
74 /// When an object gets paid by an avatar and generates the paid event,
75 /// this will pipe it to the script engine
76 /// </summary>
77 /// <param name="objectID">Object ID that got paid</param>
78 /// <param name="agentID">Agent Id that did the paying</param>
79 /// <param name="amount">Amount paid</param>
73 private void HandleObjectPaid(UUID objectID, UUID agentID, 80 private void HandleObjectPaid(UUID objectID, UUID agentID,
74 int amount) 81 int amount)
75 { 82 {
@@ -93,6 +100,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
93 } 100 }
94 } 101 }
95 102
103 /// <summary>
104 /// Handles piping the proper stuff to The script engine for touching
105 /// Including DetectedParams
106 /// </summary>
107 /// <param name="localID"></param>
108 /// <param name="originalID"></param>
109 /// <param name="offsetPos"></param>
110 /// <param name="remoteClient"></param>
111 /// <param name="surfaceArgs"></param>
96 public void touch_start(uint localID, uint originalID, Vector3 offsetPos, 112 public void touch_start(uint localID, uint originalID, Vector3 offsetPos,
97 IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) 113 IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
98 { 114 {