diff options
Diffstat (limited to 'OpenSim')
12 files changed, 82 insertions, 22 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 7ab2a03..373c7e0 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
49 | 49 | ||
50 | public PhysicsScene GetScene(string sceneIdentifier) | 50 | public PhysicsScene GetScene(string sceneIdentifier) |
51 | { | 51 | { |
52 | return new BasicScene(sceneIdentifier); | 52 | return new BasicScene(GetName(), sceneIdentifier); |
53 | } | 53 | } |
54 | 54 | ||
55 | public string GetName() | 55 | public string GetName() |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index f5826ed..c4b9117 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -49,8 +49,10 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
49 | 49 | ||
50 | //protected internal string sceneIdentifier; | 50 | //protected internal string sceneIdentifier; |
51 | 51 | ||
52 | public BasicScene(string _sceneIdentifier) | 52 | public BasicScene(string engineType, string _sceneIdentifier) |
53 | { | 53 | { |
54 | EngineType = engineType; | ||
55 | Name = EngineType + "/" + _sceneIdentifier; | ||
54 | //sceneIdentifier = _sceneIdentifier; | 56 | //sceneIdentifier = _sceneIdentifier; |
55 | } | 57 | } |
56 | 58 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs index 65be52a..9442854 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs | |||
@@ -59,7 +59,7 @@ public class BSPlugin : IPhysicsPlugin | |||
59 | { | 59 | { |
60 | if (_mScene == null) | 60 | if (_mScene == null) |
61 | { | 61 | { |
62 | _mScene = new BSScene(sceneIdentifier); | 62 | _mScene = new BSScene(GetName(), sceneIdentifier); |
63 | } | 63 | } |
64 | return (_mScene); | 64 | return (_mScene); |
65 | } | 65 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 4a6cebd..a5bdc07 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -167,11 +167,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
167 | public bool VehiclePhysicalLoggingEnabled { get; private set; } | 167 | public bool VehiclePhysicalLoggingEnabled { get; private set; } |
168 | 168 | ||
169 | #region Construction and Initialization | 169 | #region Construction and Initialization |
170 | public BSScene(string identifier) | 170 | public BSScene(string engineType, string identifier) |
171 | { | 171 | { |
172 | m_initialized = false; | 172 | m_initialized = false; |
173 | // we are passed the name of the region we're working for. | 173 | |
174 | // The name of the region we're working for is passed to us. Keep for identification. | ||
174 | RegionName = identifier; | 175 | RegionName = identifier; |
176 | |||
177 | // Set identifying variables in the PhysicsScene interface. | ||
178 | EngineType = engineType; | ||
179 | Name = EngineType + "/" + RegionName; | ||
175 | } | 180 | } |
176 | 181 | ||
177 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | 182 | public override void Initialise(IMesher meshmerizer, IConfigSource config) |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 488900e..201007b 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -62,13 +62,20 @@ namespace OpenSim.Region.Physics.Manager | |||
62 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 62 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
63 | 63 | ||
64 | /// <summary> | 64 | /// <summary> |
65 | /// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another. | 65 | /// A unique identifying string for this instance of the physics engine. |
66 | /// Useful in debug messages to distinguish one OdeScene instance from another. | ||
67 | /// Usually set to include the region name that the physics engine is acting for. | ||
66 | /// </summary> | 68 | /// </summary> |
67 | public string Name { get; protected set; } | 69 | public string Name { get; protected set; } |
68 | 70 | ||
71 | /// <summary> | ||
72 | /// A string identifying the family of this physics engine. Most common values returned | ||
73 | /// are "OpenDynamicsEngine" and "BulletSim" but others are possible. | ||
74 | /// </summary> | ||
75 | public string EngineType { get; protected set; } | ||
76 | |||
69 | // The only thing that should register for this event is the SceneGraph | 77 | // The only thing that should register for this event is the SceneGraph |
70 | // Anything else could cause problems. | 78 | // Anything else could cause problems. |
71 | |||
72 | public event physicsCrash OnPhysicsCrash; | 79 | public event physicsCrash OnPhysicsCrash; |
73 | 80 | ||
74 | public static PhysicsScene Null | 81 | public static PhysicsScene Null |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 478dd95..07663b3 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
72 | // http://opensimulator.org/mantis/view.php?id=2750). | 72 | // http://opensimulator.org/mantis/view.php?id=2750). |
73 | d.InitODE(); | 73 | d.InitODE(); |
74 | 74 | ||
75 | m_scene = new OdeScene(sceneIdentifier); | 75 | m_scene = new OdeScene(GetName(), sceneIdentifier); |
76 | } | 76 | } |
77 | 77 | ||
78 | return m_scene; | 78 | return m_scene; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index d53bd90..02a0b15 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -526,11 +526,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
526 | /// These settings need to be tweaked 'exactly' right or weird stuff happens. | 526 | /// These settings need to be tweaked 'exactly' right or weird stuff happens. |
527 | /// </summary> | 527 | /// </summary> |
528 | /// <param value="name">Name of the scene. Useful in debug messages.</param> | 528 | /// <param value="name">Name of the scene. Useful in debug messages.</param> |
529 | public OdeScene(string name) | 529 | public OdeScene(string engineType, string name) |
530 | { | 530 | { |
531 | m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name); | 531 | m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name); |
532 | 532 | ||
533 | Name = name; | 533 | Name = name; |
534 | EngineType = engineType; | ||
534 | 535 | ||
535 | nearCallback = near; | 536 | nearCallback = near; |
536 | triCallback = TriCallback; | 537 | triCallback = TriCallback; |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index e6b42e6..ed086dd 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
49 | 49 | ||
50 | public PhysicsScene GetScene(string sceneIdentifier) | 50 | public PhysicsScene GetScene(string sceneIdentifier) |
51 | { | 51 | { |
52 | return new POSScene(sceneIdentifier); | 52 | return new POSScene(GetName(), sceneIdentifier); |
53 | } | 53 | } |
54 | 54 | ||
55 | public string GetName() | 55 | public string GetName() |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs index 2f24a50..d30d482 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs | |||
@@ -43,8 +43,10 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
43 | 43 | ||
44 | //protected internal string sceneIdentifier; | 44 | //protected internal string sceneIdentifier; |
45 | 45 | ||
46 | public POSScene(String _sceneIdentifier) | 46 | public POSScene(string engineType, String _sceneIdentifier) |
47 | { | 47 | { |
48 | EngineType = engineType; | ||
49 | Name = EngineType + "/" + _sceneIdentifier; | ||
48 | //sceneIdentifier = _sceneIdentifier; | 50 | //sceneIdentifier = _sceneIdentifier; |
49 | } | 51 | } |
50 | 52 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 33c02ef..958a448 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -245,11 +245,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
245 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); | 245 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); |
246 | } | 246 | } |
247 | 247 | ||
248 | // Returns of the function is allowed. Throws a script exception if not allowed. | ||
248 | public void CheckThreatLevel(ThreatLevel level, string function) | 249 | public void CheckThreatLevel(ThreatLevel level, string function) |
249 | { | 250 | { |
250 | if (!m_OSFunctionsEnabled) | 251 | if (!m_OSFunctionsEnabled) |
251 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws | 252 | OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws |
252 | 253 | ||
254 | string reasonWhyNot = CheckThreatLevelTest(level, function); | ||
255 | if (!String.IsNullOrEmpty(reasonWhyNot)) | ||
256 | { | ||
257 | OSSLError(reasonWhyNot); | ||
258 | } | ||
259 | } | ||
260 | |||
261 | // Check to see if function is allowed. Returns an empty string if function permitted | ||
262 | // or a string explaining why this function can't be used. | ||
263 | private string CheckThreatLevelTest(ThreatLevel level, string function) | ||
264 | { | ||
253 | if (!m_FunctionPerms.ContainsKey(function)) | 265 | if (!m_FunctionPerms.ContainsKey(function)) |
254 | { | 266 | { |
255 | FunctionPerms perms = new FunctionPerms(); | 267 | FunctionPerms perms = new FunctionPerms(); |
@@ -329,10 +341,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
329 | { | 341 | { |
330 | // Allow / disallow by threat level | 342 | // Allow / disallow by threat level |
331 | if (level > m_MaxThreatLevel) | 343 | if (level > m_MaxThreatLevel) |
332 | OSSLError( | 344 | return |
333 | String.Format( | 345 | String.Format( |
334 | "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", | 346 | "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", |
335 | function, m_MaxThreatLevel, level)); | 347 | function, m_MaxThreatLevel, level); |
336 | } | 348 | } |
337 | else | 349 | else |
338 | { | 350 | { |
@@ -342,7 +354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
342 | if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) | 354 | if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) |
343 | { | 355 | { |
344 | // prim owner is in the list of allowed owners | 356 | // prim owner is in the list of allowed owners |
345 | return; | 357 | return String.Empty; |
346 | } | 358 | } |
347 | 359 | ||
348 | UUID ownerID = m_item.OwnerID; | 360 | UUID ownerID = m_item.OwnerID; |
@@ -354,7 +366,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
354 | 366 | ||
355 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) | 367 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) |
356 | { | 368 | { |
357 | return; | 369 | return String.Empty; |
358 | } | 370 | } |
359 | } | 371 | } |
360 | 372 | ||
@@ -365,7 +377,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
365 | 377 | ||
366 | if (land.LandData.OwnerID == ownerID) | 378 | if (land.LandData.OwnerID == ownerID) |
367 | { | 379 | { |
368 | return; | 380 | return String.Empty; |
369 | } | 381 | } |
370 | } | 382 | } |
371 | 383 | ||
@@ -375,7 +387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
375 | //Only Estate Managers may use the function | 387 | //Only Estate Managers may use the function |
376 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) | 388 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) |
377 | { | 389 | { |
378 | return; | 390 | return String.Empty; |
379 | } | 391 | } |
380 | } | 392 | } |
381 | 393 | ||
@@ -384,25 +396,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
384 | { | 396 | { |
385 | if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) | 397 | if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) |
386 | { | 398 | { |
387 | return; | 399 | return String.Empty; |
388 | } | 400 | } |
389 | } | 401 | } |
390 | 402 | ||
391 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) | 403 | if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) |
392 | OSSLError( | 404 | return( |
393 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", | 405 | String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", |
394 | function)); | 406 | function)); |
395 | 407 | ||
396 | if (m_item.CreatorID != ownerID) | 408 | if (m_item.CreatorID != ownerID) |
397 | { | 409 | { |
398 | if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) | 410 | if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) |
399 | OSSLError( | 411 | return String.Format("{0} permission denied. Script permissions error.", function); |
400 | String.Format("{0} permission denied. Script permissions error.", | ||
401 | function)); | ||
402 | 412 | ||
403 | } | 413 | } |
404 | } | 414 | } |
405 | } | 415 | } |
416 | return String.Empty; | ||
406 | } | 417 | } |
407 | 418 | ||
408 | internal void OSSLDeprecated(string function, string replacement) | 419 | internal void OSSLDeprecated(string function, string replacement) |
@@ -1558,6 +1569,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1558 | } | 1569 | } |
1559 | } | 1570 | } |
1560 | 1571 | ||
1572 | public string osGetPhysicsEngineType() | ||
1573 | { | ||
1574 | // High because it can be used to target attacks to known weaknesses | ||
1575 | // This would allow a new class of griefer scripts that don't even | ||
1576 | // require their user to know what they are doing (see script | ||
1577 | // kiddie) | ||
1578 | // Because it would be nice if scripts didn't blow up if the information | ||
1579 | // about the physics engine, this function returns an empty string if | ||
1580 | // the user does not have permission to see it. This as opposed to | ||
1581 | // throwing an exception. | ||
1582 | m_host.AddScriptLPS(1); | ||
1583 | string ret = String.Empty; | ||
1584 | if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType"))) | ||
1585 | { | ||
1586 | if (m_ScriptEngine.World.PhysicsScene != null) | ||
1587 | { | ||
1588 | ret = m_ScriptEngine.World.PhysicsScene.EngineType; | ||
1589 | // An old physics engine might have an uninitialized engine type | ||
1590 | if (ret == null) | ||
1591 | ret = "unknown"; | ||
1592 | } | ||
1593 | } | ||
1594 | |||
1595 | return ret; | ||
1596 | } | ||
1597 | |||
1561 | public string osGetSimulatorVersion() | 1598 | public string osGetSimulatorVersion() |
1562 | { | 1599 | { |
1563 | // High because it can be used to target attacks to known weaknesses | 1600 | // High because it can be used to target attacks to known weaknesses |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index cdd9ea8..51d0581 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -259,6 +259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
259 | 259 | ||
260 | string osGetScriptEngineName(); | 260 | string osGetScriptEngineName(); |
261 | string osGetSimulatorVersion(); | 261 | string osGetSimulatorVersion(); |
262 | string osGetPhysicsEngineType(); | ||
262 | Object osParseJSONNew(string JSON); | 263 | Object osParseJSONNew(string JSON); |
263 | Hashtable osParseJSON(string JSON); | 264 | Hashtable osParseJSON(string JSON); |
264 | 265 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index afa9ae0..c9902e4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -420,6 +420,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
420 | return m_OSSL_Functions.osGetScriptEngineName(); | 420 | return m_OSSL_Functions.osGetScriptEngineName(); |
421 | } | 421 | } |
422 | 422 | ||
423 | public string osGetPhysicsEngineType() | ||
424 | { | ||
425 | return m_OSSL_Functions.osGetPhysicsEngineType(); | ||
426 | } | ||
427 | |||
423 | public string osGetSimulatorVersion() | 428 | public string osGetSimulatorVersion() |
424 | { | 429 | { |
425 | return m_OSSL_Functions.osGetSimulatorVersion(); | 430 | return m_OSSL_Functions.osGetSimulatorVersion(); |