aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorMelanie2013-01-16 01:11:20 +0000
committerMelanie2013-01-16 01:11:20 +0000
commitfc5711fa7ab3bcd0d81737735d098f070a7132bb (patch)
tree06fbc4ebf2a4788f4ffd65010d6abadfb2ffafae /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentMerge branch 'avination' into careminster (diff)
parentBulletSim: disable center-of-mass computation for linksets until debugged. Mo... (diff)
downloadopensim-SC-fc5711fa7ab3bcd0d81737735d098f070a7132bb.zip
opensim-SC-fc5711fa7ab3bcd0d81737735d098f070a7132bb.tar.gz
opensim-SC-fc5711fa7ab3bcd0d81737735d098f070a7132bb.tar.bz2
opensim-SC-fc5711fa7ab3bcd0d81737735d098f070a7132bb.tar.xz
Merge commit '8bf0a9f85dda4b1831630b65620d5c6868196c11' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs59
1 files changed, 48 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 637d83a..4a46398 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -254,11 +254,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
254 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); 254 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
255 } 255 }
256 256
257 // Returns of the function is allowed. Throws a script exception if not allowed.
257 public void CheckThreatLevel(ThreatLevel level, string function) 258 public void CheckThreatLevel(ThreatLevel level, string function)
258 { 259 {
259 if (!m_OSFunctionsEnabled) 260 if (!m_OSFunctionsEnabled)
260 OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws 261 OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
261 262
263 string reasonWhyNot = CheckThreatLevelTest(level, function);
264 if (!String.IsNullOrEmpty(reasonWhyNot))
265 {
266 OSSLError(reasonWhyNot);
267 }
268 }
269
270 // Check to see if function is allowed. Returns an empty string if function permitted
271 // or a string explaining why this function can't be used.
272 private string CheckThreatLevelTest(ThreatLevel level, string function)
273 {
262 if (!m_FunctionPerms.ContainsKey(function)) 274 if (!m_FunctionPerms.ContainsKey(function))
263 { 275 {
264 FunctionPerms perms = new FunctionPerms(); 276 FunctionPerms perms = new FunctionPerms();
@@ -338,10 +350,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
338 { 350 {
339 // Allow / disallow by threat level 351 // Allow / disallow by threat level
340 if (level > m_MaxThreatLevel) 352 if (level > m_MaxThreatLevel)
341 OSSLError( 353 return
342 String.Format( 354 String.Format(
343 "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.", 355 "{0} permission denied. Allowed threat level is {1} but function threat level is {2}.",
344 function, m_MaxThreatLevel, level)); 356 function, m_MaxThreatLevel, level);
345 } 357 }
346 else 358 else
347 { 359 {
@@ -351,7 +363,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
351 if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) 363 if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID))
352 { 364 {
353 // prim owner is in the list of allowed owners 365 // prim owner is in the list of allowed owners
354 return; 366 return String.Empty;
355 } 367 }
356 368
357 UUID ownerID = m_item.OwnerID; 369 UUID ownerID = m_item.OwnerID;
@@ -363,7 +375,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
363 375
364 if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) 376 if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero)
365 { 377 {
366 return; 378 return String.Empty;
367 } 379 }
368 } 380 }
369 381
@@ -374,7 +386,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
374 386
375 if (land.LandData.OwnerID == ownerID) 387 if (land.LandData.OwnerID == ownerID)
376 { 388 {
377 return; 389 return String.Empty;
378 } 390 }
379 } 391 }
380 392
@@ -384,7 +396,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
384 //Only Estate Managers may use the function 396 //Only Estate Managers may use the function
385 if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) 397 if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID)
386 { 398 {
387 return; 399 return String.Empty;
388 } 400 }
389 } 401 }
390 402
@@ -393,25 +405,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
393 { 405 {
394 if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) 406 if (World.RegionInfo.EstateSettings.EstateOwner == ownerID)
395 { 407 {
396 return; 408 return String.Empty;
397 } 409 }
398 } 410 }
399 411
400 if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) 412 if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID))
401 OSSLError( 413 return(
402 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.", 414 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.",
403 function)); 415 function));
404 416
405 if (m_item.CreatorID != ownerID) 417 if (m_item.CreatorID != ownerID)
406 { 418 {
407 if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) 419 if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0)
408 OSSLError( 420 return String.Format("{0} permission denied. Script permissions error.", function);
409 String.Format("{0} permission denied. Script permissions error.",
410 function));
411 421
412 } 422 }
413 } 423 }
414 } 424 }
425 return String.Empty;
415 } 426 }
416 427
417 internal void OSSLDeprecated(string function, string replacement) 428 internal void OSSLDeprecated(string function, string replacement)
@@ -1567,6 +1578,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1567 } 1578 }
1568 } 1579 }
1569 1580
1581 public string osGetPhysicsEngineType()
1582 {
1583 // High because it can be used to target attacks to known weaknesses
1584 // This would allow a new class of griefer scripts that don't even
1585 // require their user to know what they are doing (see script
1586 // kiddie)
1587 // Because it would be nice if scripts didn't blow up if the information
1588 // about the physics engine, this function returns an empty string if
1589 // the user does not have permission to see it. This as opposed to
1590 // throwing an exception.
1591 m_host.AddScriptLPS(1);
1592 string ret = String.Empty;
1593 if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType")))
1594 {
1595 if (m_ScriptEngine.World.PhysicsScene != null)
1596 {
1597 ret = m_ScriptEngine.World.PhysicsScene.EngineType;
1598 // An old physics engine might have an uninitialized engine type
1599 if (ret == null)
1600 ret = "unknown";
1601 }
1602 }
1603
1604 return ret;
1605 }
1606
1570 public string osGetSimulatorVersion() 1607 public string osGetSimulatorVersion()
1571 { 1608 {
1572 // High because it can be used to target attacks to known weaknesses 1609 // High because it can be used to target attacks to known weaknesses