mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 22:26:09 +08:00
Merge commit '8bf0a9f85dda4b1831630b65620d5c6868196c11' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
This commit is contained in:
@@ -254,11 +254,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
|
||||
}
|
||||
|
||||
// Returns of the function is allowed. Throws a script exception if not allowed.
|
||||
public void CheckThreatLevel(ThreatLevel level, string function)
|
||||
{
|
||||
if (!m_OSFunctionsEnabled)
|
||||
OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
|
||||
|
||||
string reasonWhyNot = CheckThreatLevelTest(level, function);
|
||||
if (!String.IsNullOrEmpty(reasonWhyNot))
|
||||
{
|
||||
OSSLError(reasonWhyNot);
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if function is allowed. Returns an empty string if function permitted
|
||||
// or a string explaining why this function can't be used.
|
||||
private string CheckThreatLevelTest(ThreatLevel level, string function)
|
||||
{
|
||||
if (!m_FunctionPerms.ContainsKey(function))
|
||||
{
|
||||
FunctionPerms perms = new FunctionPerms();
|
||||
@@ -338,10 +350,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
// Allow / disallow by threat level
|
||||
if (level > m_MaxThreatLevel)
|
||||
OSSLError(
|
||||
return
|
||||
String.Format(
|
||||
"{0} permission denied. Allowed threat level is {1} but function threat level is {2}.",
|
||||
function, m_MaxThreatLevel, level));
|
||||
function, m_MaxThreatLevel, level);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -351,7 +363,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID))
|
||||
{
|
||||
// prim owner is in the list of allowed owners
|
||||
return;
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
UUID ownerID = m_item.OwnerID;
|
||||
@@ -363,7 +375,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero)
|
||||
{
|
||||
return;
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,7 +386,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
if (land.LandData.OwnerID == ownerID)
|
||||
{
|
||||
return;
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,7 +396,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
//Only Estate Managers may use the function
|
||||
if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID)
|
||||
{
|
||||
return;
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,25 +405,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
if (World.RegionInfo.EstateSettings.EstateOwner == ownerID)
|
||||
{
|
||||
return;
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID))
|
||||
OSSLError(
|
||||
return(
|
||||
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.",
|
||||
function));
|
||||
|
||||
if (m_item.CreatorID != ownerID)
|
||||
{
|
||||
if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0)
|
||||
OSSLError(
|
||||
String.Format("{0} permission denied. Script permissions error.",
|
||||
function));
|
||||
return String.Format("{0} permission denied. Script permissions error.", function);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
internal void OSSLDeprecated(string function, string replacement)
|
||||
@@ -1567,6 +1578,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
public string osGetPhysicsEngineType()
|
||||
{
|
||||
// High because it can be used to target attacks to known weaknesses
|
||||
// This would allow a new class of griefer scripts that don't even
|
||||
// require their user to know what they are doing (see script
|
||||
// kiddie)
|
||||
// Because it would be nice if scripts didn't blow up if the information
|
||||
// about the physics engine, this function returns an empty string if
|
||||
// the user does not have permission to see it. This as opposed to
|
||||
// throwing an exception.
|
||||
m_host.AddScriptLPS(1);
|
||||
string ret = String.Empty;
|
||||
if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType")))
|
||||
{
|
||||
if (m_ScriptEngine.World.PhysicsScene != null)
|
||||
{
|
||||
ret = m_ScriptEngine.World.PhysicsScene.EngineType;
|
||||
// An old physics engine might have an uninitialized engine type
|
||||
if (ret == null)
|
||||
ret = "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public string osGetSimulatorVersion()
|
||||
{
|
||||
// High because it can be used to target attacks to known weaknesses
|
||||
|
||||
@@ -259,6 +259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
|
||||
string osGetScriptEngineName();
|
||||
string osGetSimulatorVersion();
|
||||
string osGetPhysicsEngineType();
|
||||
Object osParseJSONNew(string JSON);
|
||||
Hashtable osParseJSON(string JSON);
|
||||
|
||||
|
||||
@@ -420,6 +420,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_OSSL_Functions.osGetScriptEngineName();
|
||||
}
|
||||
|
||||
public string osGetPhysicsEngineType()
|
||||
{
|
||||
return m_OSSL_Functions.osGetPhysicsEngineType();
|
||||
}
|
||||
|
||||
public string osGetSimulatorVersion()
|
||||
{
|
||||
return m_OSSL_Functions.osGetSimulatorVersion();
|
||||
|
||||
Reference in New Issue
Block a user