Merge branch 'avination-current' into careminster

Conflicts:
	OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
	OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
avinationmerge
Melanie 2013-09-16 22:32:53 +01:00
commit 72206a0e29
15 changed files with 147 additions and 88 deletions

View File

@ -196,7 +196,9 @@ namespace OpenSim
m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true); m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true);
string permissionModules = startupConfig.GetString("permissionmodules", "DefaultPermissionsModule"); string permissionModules = Util.GetConfigVarFromSections<string>(Config, "permissionmodules",
new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
m_permsModules = new List<string>(permissionModules.Split(',')); m_permsModules = new List<string>(permissionModules.Split(','));
managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty); managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
@ -392,29 +394,19 @@ namespace OpenSim
} }
else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing..."); else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
// XPTO: Fix this if (m_securePermissionsLoading)
// if (m_securePermissionsLoading) {
// { foreach (string s in m_permsModules)
// foreach (string s in m_permsModules) {
// { if (!scene.RegionModules.ContainsKey(s))
// if (!scene.RegionModules.ContainsKey(s)) {
// { m_log.Fatal("[MODULES]: Required module " + s + " not found.");
// bool found = false; Environment.Exit(0);
// foreach (IRegionModule m in modules) }
// { }
// if (m.Name == s)
// { m_log.InfoFormat("[SCENE]: Secure permissions loading enabled, modules loaded: {0}", String.Join(" ", m_permsModules.ToArray()));
// found = true; }
// }
// }
// if (!found)
// {
// m_log.Fatal("[MODULES]: Required module " + s + " not found.");
// Environment.Exit(0);
// }
// }
// }
// }
scene.SetModuleInterfaces(); scene.SetModuleInterfaces();
// First Step of bootreport sequence // First Step of bootreport sequence

View File

@ -77,6 +77,8 @@ namespace OpenSim.Region.ClientStack.Linden
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
private static Thread[] m_workerThreads = null; private static Thread[] m_workerThreads = null;
private string m_Url = "localhost";
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
new OpenMetaverse.BlockingQueue<aPollRequest>(); new OpenMetaverse.BlockingQueue<aPollRequest>();
@ -88,6 +90,9 @@ namespace OpenSim.Region.ClientStack.Linden
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig config = source.Configs["ClientStack.LindenCaps"];
if (config != null)
m_Url = config.GetString("Cap_GetTexture", "localhost");
} }
public void AddRegion(Scene s) public void AddRegion(Scene s)
@ -345,32 +350,38 @@ namespace OpenSim.Region.ClientStack.Linden
private void RegisterCaps(UUID agentID, Caps caps) private void RegisterCaps(UUID agentID, Caps caps)
{ {
m_URL = "/CAPS/" + UUID.Random() + "/"; if (m_Url == "localhost")
// Register this as a poll service
PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
args.Type = PollServiceEventArgs.EventType.Texture;
MainServer.Instance.AddPollServiceHTTPHandler(m_URL, args);
string hostName = m_scene.RegionInfo.ExternalHostName;
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
string protocol = "http";
if (MainServer.Instance.UseSSL)
{ {
hostName = MainServer.Instance.SSLCommonName; string capUrl = "/CAPS/" + UUID.Random() + "/";
port = MainServer.Instance.SSLPort;
protocol = "https";
}
IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); // Register this as a poll service
if (handler != null) PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", m_URL);
args.Type = PollServiceEventArgs.EventType.Texture;
MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
string hostName = m_scene.RegionInfo.ExternalHostName;
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
string protocol = "http";
if (MainServer.Instance.UseSSL)
{
hostName = MainServer.Instance.SSLCommonName;
port = MainServer.Instance.SSLPort;
protocol = "https";
}
IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
if (handler != null)
handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl);
else
caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
m_pollservices[agentID] = args;
m_capsDict[agentID] = capUrl;
}
else else
caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, m_URL)); {
m_pollservices[agentID] = args; caps.RegisterHandler("GetTexture", m_Url);
m_capsDict[agentID] = m_URL; }
} }
private void DeregisterCaps(UUID agentID, Caps caps) private void DeregisterCaps(UUID agentID, Caps caps)

View File

@ -4004,6 +4004,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
part.Shape.ProfileHollow = 27500; part.Shape.ProfileHollow = 27500;
} }
} }
else if (update.Entity is ScenePresence)
{
ScenePresence presence = (ScenePresence)update.Entity;
// If ParentUUID is not UUID.Zero and ParentID is 0, this
// avatar is in the process of crossing regions while
// sat on an object. In this state, we don't want any
// updates because they will visually orbit the avatar.
// Update will be forced once crossing is completed anyway.
if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0)
continue;
}
++updatesThisCall; ++updatesThisCall;

View File

@ -182,6 +182,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
try try
{ {
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (obj == null)
return;
if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
|| avatar.Scene.RegionInfo.RegionSettings.AllowDamage) || avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
{ {

View File

@ -42,8 +42,8 @@ using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.CoreModules.World.Permissions namespace OpenSim.Region.CoreModules.World.Permissions
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultPermissionsModule")]
public class PermissionsModule : INonSharedRegionModule, IPermissionsModule public class DefaultPermissionsModule : INonSharedRegionModule, IPermissionsModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -348,7 +348,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
public string Name public string Name
{ {
get { return "PermissionsModule"; } get { return "DefaultPermissionsModule"; }
} }
public Type ReplaceableInterface public Type ReplaceableInterface

View File

@ -2820,8 +2820,10 @@ namespace OpenSim.Region.Framework.Scenes
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts(); newObject.ResumeScripts();
if (newObject.RootPart.KeyframeMotion != null) // AddSceneObject already does this and doing it again messes
newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); // up region crossings, so don't.
//if (newObject.RootPart.KeyframeMotion != null)
// newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
} }
// Do this as late as possible so that listeners have full access to the incoming object // Do this as late as possible so that listeners have full access to the incoming object

View File

@ -591,6 +591,7 @@ namespace OpenSim.Region.Framework.Scenes
avinfo.ParentID = av.ParentID; avinfo.ParentID = av.ParentID;
avsToCross.Add(avinfo); avsToCross.Add(avinfo);
av.PrevSitOffset = av.OffsetPosition;
av.ParentID = 0; av.ParentID = 0;
} }

View File

@ -265,7 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
private int m_movementAnimationUpdateCounter = 0; private int m_movementAnimationUpdateCounter = 0;
private Vector3 m_prevSitOffset; public Vector3 PrevSitOffset { get; set; }
protected AvatarAppearance m_appearance; protected AvatarAppearance m_appearance;
@ -997,7 +997,7 @@ namespace OpenSim.Region.Framework.Scenes
// ParentPosition = part.GetWorldPosition(); // ParentPosition = part.GetWorldPosition();
ParentID = part.LocalId; ParentID = part.LocalId;
ParentPart = part; ParentPart = part;
m_pos = m_prevSitOffset; m_pos = PrevSitOffset;
// pos = ParentPosition; // pos = ParentPosition;
pos = part.GetWorldPosition(); pos = part.GetWorldPosition();
} }
@ -2414,6 +2414,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentID != 0) if (ParentID != 0)
{ {
PrevSitOffset = m_pos; // Save sit offset
SceneObjectPart part = ParentPart; SceneObjectPart part = ParentPart;
UnRegisterSeatControls(part.ParentGroup.UUID); UnRegisterSeatControls(part.ParentGroup.UUID);
@ -3649,7 +3650,7 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.Appearance = new AvatarAppearance(Appearance); cAgent.Appearance = new AvatarAppearance(Appearance);
cAgent.ParentPart = ParentUUID; cAgent.ParentPart = ParentUUID;
cAgent.SitOffset = m_pos; cAgent.SitOffset = PrevSitOffset;
lock (scriptedcontrols) lock (scriptedcontrols)
{ {
@ -3692,7 +3693,7 @@ namespace OpenSim.Region.Framework.Scenes
CameraLeftAxis = cAgent.LeftAxis; CameraLeftAxis = cAgent.LeftAxis;
CameraUpAxis = cAgent.UpAxis; CameraUpAxis = cAgent.UpAxis;
ParentUUID = cAgent.ParentPart; ParentUUID = cAgent.ParentPart;
m_prevSitOffset = cAgent.SitOffset; PrevSitOffset = cAgent.SitOffset;
// When we get to the point of re-computing neighbors everytime this // When we get to the point of re-computing neighbors everytime this
// changes, then start using the agent's drawdistance rather than the // changes, then start using the agent's drawdistance rather than the

View File

@ -83,8 +83,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene(); TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, new PermissionsModule()); IConfigSource configSource = new IniConfigSource();
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, userId).ControllingClient; IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test. // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
@ -106,9 +109,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Null); Assert.That(retrievedPart2, Is.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(1));
Assert.That(client.ReceivedKills[0], Is.EqualTo(soLocalId));
} }
/// <summary> /// <summary>
@ -135,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneHelpers.SetupSceneModules(sceneB, config, etmB); SceneHelpers.SetupSceneModules(sceneB, config, etmB);
// We need this for derez // We need this for derez
SceneHelpers.SetupSceneModules(sceneA, new PermissionsModule()); //SceneHelpers.SetupSceneModules(sceneA, new PermissionsModule());
UserAccount uaA = UserAccountHelpers.CreateUserWithInventory(sceneA, "Andy", "AAA", 0x1, ""); UserAccount uaA = UserAccountHelpers.CreateUserWithInventory(sceneA, "Andy", "AAA", 0x1, "");
UserAccount uaB = UserAccountHelpers.CreateUserWithInventory(sceneA, "Brian", "BBB", 0x2, ""); UserAccount uaB = UserAccountHelpers.CreateUserWithInventory(sceneA, "Brian", "BBB", 0x2, "");
@ -155,12 +155,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
uint soLocalId = so.LocalId; uint soLocalId = so.LocalId;
sceneA.DeleteSceneObject(so, false); sceneA.DeleteSceneObject(so, false);
Assert.That(clientA.ReceivedKills.Count, Is.EqualTo(1));
Assert.That(clientA.ReceivedKills[0], Is.EqualTo(soLocalId));
Assert.That(childClientsB[0].ReceivedKills.Count, Is.EqualTo(1));
Assert.That(childClientsB[0].ReceivedKills[0], Is.EqualTo(soLocalId));
} }
/// <summary> /// <summary>
@ -179,7 +173,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene(); TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, new PermissionsModule()); IConfigSource configSource = new IniConfigSource();
IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test. // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.

View File

@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneHelpers.SetupSceneModules( SceneHelpers.SetupSceneModules(
scene, configSource, new object[] scene, configSource, new object[]
{ new PermissionsModule(), { new DefaultPermissionsModule(),
new GroupsModule(), new GroupsModule(),
new MockGroupsServicesConnector() }); new MockGroupsServicesConnector() });

View File

@ -282,7 +282,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// We need to set up the permisions module on scene B so that our later use of agent limit to deny // We need to set up the permisions module on scene B so that our later use of agent limit to deny
// QueryAccess won't succeed anyway because administrators are always allowed in and the default // QueryAccess won't succeed anyway because administrators are always allowed in and the default
// IsAdministrator if no permissions module is present is true. // IsAdministrator if no permissions module is present is true.
SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new DefaultPermissionsModule(), etmB });
// Shared scene modules // Shared scene modules
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
@ -447,7 +447,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// We need to set up the permisions module on scene B so that our later use of agent limit to deny // We need to set up the permisions module on scene B so that our later use of agent limit to deny
// QueryAccess won't succeed anyway because administrators are always allowed in and the default // QueryAccess won't succeed anyway because administrators are always allowed in and the default
// IsAdministrator if no permissions module is present is true. // IsAdministrator if no permissions module is present is true.
SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new DefaultPermissionsModule(), etmB });
// Shared scene modules // Shared scene modules
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);

View File

@ -231,6 +231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ItemID = ScriptTask.ItemID; ItemID = ScriptTask.ItemID;
AssetID = ScriptTask.AssetID; AssetID = ScriptTask.AssetID;
} }
LocalID = part.LocalId;
PrimName = part.ParentGroup.Name; PrimName = part.ParentGroup.Name;
StartParam = startParam; StartParam = startParam;

View File

@ -1316,13 +1316,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
ScriptInstance instance = null; ScriptInstance instance = null;
// Create the object record // Create the object record
UUID appDomain = assetID;
lockScriptsForRead(true); lockScriptsForRead(true);
if ((!m_Scripts.ContainsKey(itemID)) || if ((!m_Scripts.ContainsKey(itemID)) ||
(m_Scripts[itemID].AssetID != assetID)) (m_Scripts[itemID].AssetID != assetID))
{ {
lockScriptsForRead(false); lockScriptsForRead(false);
instance = new ScriptInstance(this, part,
item,
startParam, postOnRez,
m_MaxScriptQueue);
UUID appDomain = assetID;
if (part.ParentGroup.IsAttachment) if (part.ParentGroup.IsAttachment)
appDomain = part.ParentGroup.RootPart.UUID; appDomain = part.ParentGroup.RootPart.UUID;
@ -1345,9 +1353,39 @@ namespace OpenSim.Region.ScriptEngine.XEngine
sandbox = AppDomain.CreateDomain( sandbox = AppDomain.CreateDomain(
m_Scene.RegionInfo.RegionID.ToString(), m_Scene.RegionInfo.RegionID.ToString(),
evidence, appSetup); evidence, appSetup);
m_AppDomains[appDomain].AssemblyResolve += if (m_AppDomains.ContainsKey(appDomain))
new ResolveEventHandler( {
AssemblyResolver.OnAssemblyResolve); m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
if (m_DomainScripts.ContainsKey(appDomain))
{
m_DomainScripts[appDomain].Add(itemID);
}
else
{
m_DomainScripts.Add(appDomain, new List<UUID>());
m_DomainScripts[appDomain].Add(itemID);
}
}
else
{
m_AppDomains.Add(appDomain, sandbox);
m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
if (m_DomainScripts.ContainsKey(appDomain))
{
m_DomainScripts[appDomain].Add(itemID);
}
else
{
m_DomainScripts.Add(appDomain, new List<UUID>());
m_DomainScripts[appDomain].Add(itemID);
}
}
} }
else else
{ {
@ -1373,12 +1411,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false; return false;
} }
} }
m_DomainScripts[appDomain].Add(itemID);
instance = new ScriptInstance(this, part,
item,
startParam, postOnRez,
m_MaxScriptQueue);
instance.Load(m_AppDomains[appDomain], assembly, stateSource); instance.Load(m_AppDomains[appDomain], assembly, stateSource);
// m_log.DebugFormat( // m_log.DebugFormat(
@ -1502,6 +1535,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (handlerObjectRemoved != null) if (handlerObjectRemoved != null)
{ {
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
if (part != null)
handlerObjectRemoved(part.UUID); handlerObjectRemoved(part.UUID);
} }

View File

@ -143,7 +143,13 @@ namespace OpenSim.Services.Connectors
string prefix = id.Substring(0, 2).ToLower(); string prefix = id.Substring(0, 2).ToLower();
string host = m_UriMap[prefix]; string host;
// HG URLs will not be valid UUIDS
if (m_UriMap.ContainsKey(prefix))
host = m_UriMap[prefix];
else
host = m_UriMap["00"];
serverUri.Host = host; serverUri.Host = host;