From 43a2da9edb9a234ee10735a234d2ad253a33cb7a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 6 Jul 2012 22:33:16 +0100 Subject: Pull prim crossing/teleport checks up into Scene.IncomingCreateObject() from Scene.AddObject() Only IncomingCreateObject() needs these checks. General object adding does not need to perform crossing perm checks --- OpenSim/Region/Framework/Scenes/Scene.cs | 41 +++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 36d39ea..6239d51 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2495,7 +2495,16 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.WarnFormat("[SCENE]: Problem casting object, exception {0}{1}", e.Message, e.StackTrace); + m_log.WarnFormat("[INTERREGION]: Problem casting object, exception {0}{1}", e.Message, e.StackTrace); + return false; + } + + // If the user is banned, we won't let any of their objects + // enter. Period. + // + if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) + { + m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); return false; } @@ -2504,14 +2513,28 @@ namespace OpenSim.Region.Framework.Scenes if (!AddSceneObject(newObject)) { - m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); + m_log.DebugFormat( + "[INTERREGION]: Problem adding scene object {0} in {1} ", newObject.UUID, RegionInfo.RegionName); return false; } - // For attachments, we need to wait until the agent is root - // before we restart the scripts, or else some functions won't work. if (!newObject.IsAttachment) { + // FIXME: It would be better to never add the scene object at all rather than add it and then delete + // it + if (!Permissions.CanObjectEntry(newObject.UUID, true, newObject.AbsolutePosition)) + { + // Deny non attachments based on parcel settings + // + m_log.Info("[INTERREGION]: Denied prim crossing because of parcel settings"); + + DeleteSceneObject(newObject, false); + + return false; + } + + // For attachments, we need to wait until the agent is root + // before we restart the scripts, or else some functions won't work. newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); newObject.ResumeScripts(); } @@ -2531,16 +2554,6 @@ namespace OpenSim.Region.Framework.Scenes /// True if the SceneObjectGroup was added, False if it was not public bool AddSceneObject(SceneObjectGroup sceneObject) { - // If the user is banned, we won't let any of their objects - // enter. Period. - // - if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) - { - m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); - - return false; - } - sceneObject.SetScene(this); // Force allocation of new LocalId -- cgit v1.1