From 9090a907692e7deaafd79150bf6482507be86d55 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 16 Aug 2009 03:48:16 +1000 Subject: * Beginnings of a Security Credential system in MRM. This will eventually lead to trusted execution of untrusted MRMs. --- .../Scripting/Minimodule/ISecurityCredential.cs | 7 +++++++ .../Scripting/Minimodule/MRMModule.cs | 10 ++++++++-- .../Scripting/Minimodule/ObjectAccessor.cs | 22 +++++++++++++--------- .../Scripting/Minimodule/SOPObject.cs | 9 +++++++++ .../Scripting/Minimodule/SecurityCredential.cs | 21 +++++++++++++++++++++ .../OptionalModules/Scripting/Minimodule/World.cs | 6 ++++-- 6 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs new file mode 100644 index 0000000..464723e --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs @@ -0,0 +1,7 @@ +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + public interface ISecurityCredential + { + ISocialEntity owner { get; } + } +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 5ed9af3..0cc7930 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -166,8 +166,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host) { - world = new World(m_scene); - host = new Host(new SOPObject(m_scene, localID), m_scene, new ExtensionHandler(m_extensions), m_microthreads); + // UUID should be changed to object owner. + UUID owner = m_scene.RegionInfo.MasterAvatarAssignedUUID; + SEUser securityUser = new SEUser(owner, "Name Unassigned"); + SecurityCredential creds = new SecurityCredential(securityUser); + + world = new World(m_scene, creds); + host = new Host(new SOPObject(m_scene, localID, creds), m_scene, new ExtensionHandler(m_extensions), + m_microthreads); } public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID) diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs index 4638ad0..6ba5ccf 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs @@ -40,10 +40,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { private readonly Scene m_scene; private readonly IEnumerator m_sogEnum; + private readonly ISecurityCredential m_security; - public IObjEnum(Scene scene) + public IObjEnum(Scene scene, ISecurityCredential security) { m_scene = scene; + m_security = security; m_sogEnum = m_scene.Entities.GetAllByType().GetEnumerator(); } @@ -66,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { get { - return new SOPObject(m_scene, m_sogEnum.Current.LocalId); + return new SOPObject(m_scene, m_sogEnum.Current.LocalId, m_security); } } @@ -79,17 +81,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor { private readonly Scene m_scene; + private readonly ISecurityCredential m_security; - public ObjectAccessor(Scene scene) + public ObjectAccessor(Scene scene, ISecurityCredential security) { m_scene = scene; + m_security = security; } public IObject this[int index] { get { - return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId); + return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId, m_security); } } @@ -97,7 +101,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { get { - return new SOPObject(m_scene, m_scene.Entities[index].LocalId); + return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security); } } @@ -105,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { get { - return new SOPObject(m_scene, m_scene.Entities[index].LocalId); + return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security); } } @@ -117,20 +121,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public IObject Create(Vector3 position, Quaternion rotation) { - SceneObjectGroup sog = m_scene.AddNewPrim(m_scene.RegionInfo.MasterAvatarAssignedUUID, + SceneObjectGroup sog = m_scene.AddNewPrim(m_security.owner.GlobalID, UUID.Zero, position, rotation, PrimitiveBaseShape.CreateBox()); - IObject ret = new SOPObject(m_scene, sog.LocalId); + IObject ret = new SOPObject(m_scene, sog.LocalId, m_security); return ret; } public IEnumerator GetEnumerator() { - return new IObjEnum(m_scene); + return new IObjEnum(m_scene, m_security); } IEnumerator IEnumerable.GetEnumerator() diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index bc26389..fa9ef53 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -42,13 +42,22 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { private readonly Scene m_rootScene; private readonly uint m_localID; + private readonly ISecurityCredential m_security; + [Obsolete("Replace with 'credential' constructor [security]")] public SOPObject(Scene rootScene, uint localID) { m_rootScene = rootScene; m_localID = localID; } + public SOPObject(Scene rootScene, uint localID, ISecurityCredential credential) + { + m_rootScene = rootScene; + m_localID = localID; + m_security = credential; + } + /// /// This needs to run very, very quickly. /// It is utilized in nearly every property and method. diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs new file mode 100644 index 0000000..bd4440c --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + class SecurityCredential : ISecurityCredential + { + private readonly ISocialEntity m_owner; + + public SecurityCredential(ISocialEntity m_owner) + { + this.m_owner = m_owner; + } + + public ISocialEntity owner + { + get { return m_owner; } + } + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index 1ec4a33..a34684f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs @@ -37,15 +37,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public class World : System.MarshalByRefObject, IWorld, IWorldAudio { private readonly Scene m_internalScene; + private readonly ISecurityCredential m_security; private readonly Heightmap m_heights; private readonly ObjectAccessor m_objs; - public World(Scene internalScene) + public World(Scene internalScene, ISecurityCredential securityCredential) { + m_security = securityCredential; m_internalScene = internalScene; m_heights = new Heightmap(m_internalScene); - m_objs = new ObjectAccessor(m_internalScene); + m_objs = new ObjectAccessor(m_internalScene, securityCredential); } #region Events -- cgit v1.1 From a42569d89675430087d32332e168429d4185311c Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 16 Aug 2009 15:06:06 +0900 Subject: Thanks dmiles for a patch that adds PacketType.RequestMultipleObjects Packet Handler - ref mantis #4010 --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 25 ++++++++++++++++++++++ .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 1 + .../Framework/Scenes/Scene.PacketHandlers.cs | 23 ++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 1 + .../Server/IRCClientView.cs | 1 + .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 1 + 6 files changed, 52 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7633b7b..12c2d86 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -197,6 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private ObjectExtraParams handlerUpdateExtraParams; //OnUpdateExtraParams; private ObjectDuplicate handlerObjectDuplicate; private ObjectDuplicateOnRay handlerObjectDuplicateOnRay; + private ObjectRequest handlerObjectRequest; private ObjectSelect handlerObjectSelect; private ObjectDeselect handlerObjectDeselect; private ObjectIncludeInSearch handlerObjectIncludeInSearch; @@ -1083,6 +1084,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event GodKickUser OnGodKickUser; public event ObjectExtraParams OnUpdateExtraParams; public event UpdateShape OnUpdatePrimShape; + public event ObjectRequest OnObjectRequest; public event ObjectSelect OnObjectSelect; public event ObjectDeselect OnObjectDeselect; public event GenericCall7 OnObjectDescription; @@ -5937,6 +5939,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP break; + case PacketType.RequestMultipleObjects: + RequestMultipleObjectsPacket incomingRequest = (RequestMultipleObjectsPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (incomingRequest.AgentData.SessionID != SessionId || + incomingRequest.AgentData.AgentID != AgentId) + break; + } + #endregion + + handlerObjectRequest = null; + + for (int i = 0; i < incomingRequest.ObjectData.Length; i++) + { + handlerObjectRequest = OnObjectRequest; + if (handlerObjectRequest != null) + { + handlerObjectRequest(incomingRequest.ObjectData[i].ID, this); + } + } + break; case PacketType.ObjectSelect: ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 62779e7..e9c35e9 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -107,6 +107,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event UpdateShape OnUpdatePrimShape; public event ObjectExtraParams OnUpdateExtraParams; public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; + public event ObjectRequest OnObjectRequest; public event ObjectSelect OnObjectSelect; public event GenericCall7 OnObjectDescription; public event GenericCall7 OnObjectName; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 113918d..1a7f8f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -109,6 +109,29 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Invoked when the client requests a prim. + /// + /// + /// + public void RequestPrim(uint primLocalID, IClientAPI remoteClient) + { + PacketType i = PacketType.ObjectUpdate; + List EntityList = GetEntities(); + + foreach (EntityBase ent in EntityList) + { + if (ent is SceneObjectGroup) + { + if (((SceneObjectGroup)ent).LocalId == primLocalID) + { + ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient); + return; + } + } + } + } + + /// /// Invoked when the client selects a prim. /// /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 18d7bad..a2275f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2076,6 +2076,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; client.OnTeleportLocationRequest += RequestTeleportLocation; client.OnTeleportLandmarkRequest += RequestTeleportLandmark; + client.OnObjectRequest += RequestPrim; client.OnObjectSelect += SelectPrim; client.OnObjectDeselect += DeselectPrim; client.OnGrabUpdate += m_sceneGraph.MoveObject; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 08fc61f..a3be181 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -686,6 +686,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event SpinStop OnSpinStop; public event UpdateShape OnUpdatePrimShape; public event ObjectExtraParams OnUpdateExtraParams; + public event ObjectRequest OnObjectRequest; public event ObjectSelect OnObjectSelect; public event ObjectDeselect OnObjectDeselect; public event GenericCall7 OnObjectDescription; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 4a8ba8c..f0bdf3b 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -213,6 +213,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event UpdateShape OnUpdatePrimShape; public event ObjectExtraParams OnUpdateExtraParams; public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; + public event ObjectRequest OnObjectRequest; public event ObjectSelect OnObjectSelect; public event GenericCall7 OnObjectDescription; public event GenericCall7 OnObjectName; -- cgit v1.1 From 9d9fcac0386ba6adc7a1f6c08f82bd5c0b6cd1d2 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Fri, 14 Aug 2009 17:16:41 +0900 Subject: Misc cleanup. --- .../InterGrid/OpenGridProtocolModule.cs | 14 +++--- OpenSim/Region/Framework/Scenes/EventManager.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 17 +++---- .../Region/Framework/Scenes/SceneObjectGroup.cs | 51 ++++++--------------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 52 +++++++++++----------- .../Scripting/Minimodule/Interfaces/IObject.cs | 2 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 13 ++---- 7 files changed, 58 insertions(+), 93 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index bcf20be..e9c1e9d 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.InterGrid responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName); - // DEPRECIATED + // DEPRECATED responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); responseMap["connect"] = OSD.FromBoolean(true); @@ -591,7 +591,7 @@ namespace OpenSim.Region.CoreModules.InterGrid httpaddr = httpsCN; } - // DEPRECIATED + // DEPRECATED responseMap["seed_capability"] = OSD.FromString( regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); @@ -764,7 +764,7 @@ namespace OpenSim.Region.CoreModules.InterGrid responseMap["sim_port"] = OSD.FromInteger(reg.InternalEndPoint.Port); responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName);// + ":" + reg.InternalEndPoint.Port.ToString()); - // DEPRECIATED + // DEPRECATED responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); responseMap["session_id"] = OSD.FromUUID(SessionID); @@ -851,7 +851,7 @@ namespace OpenSim.Region.CoreModules.InterGrid string rezRespSeedCap = ""; - // DEPRECIATED + // DEPRECATED if (rezResponseMap.ContainsKey("seed_capability")) rezRespSeedCap = rezResponseMap["seed_capability"].AsString(); @@ -863,7 +863,7 @@ namespace OpenSim.Region.CoreModules.InterGrid if (rezResponseMap.ContainsKey("rez_avatar/rez")) rezRespSeedCap = rezResponseMap["rez_avatar/rez"].AsString(); - // DEPRECIATED + // DEPRECATED string rezRespSim_ip = rezResponseMap["sim_ip"].AsString(); string rezRespSim_host = rezResponseMap["sim_host"].AsString(); @@ -879,13 +879,13 @@ namespace OpenSim.Region.CoreModules.InterGrid { RezResponsePositionArray = (OSDArray)rezResponseMap["position"]; } - // DEPRECIATED + // DEPRECATED responseMap["seed_capability"] = OSD.FromString(rezRespSeedCap); // REPLACEMENT r3 responseMap["region_seed_capability"] = OSD.FromString(rezRespSeedCap); - // DEPRECIATED + // DEPRECATED responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString()); responseMap["sim_host"] = OSD.FromString(rezRespSim_host); diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 7bbe045..287d8d9 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate void OnNewClientDelegate(IClientAPI client); /// - /// Depreciated in favour of OnClientConnect. + /// Deprecated in favour of OnClientConnect. /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces. /// public event OnNewClientDelegate OnNewClient; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0e0999a..7771831 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -928,25 +928,22 @@ namespace OpenSim.Region.Framework.Scenes { // Primitive Ray Tracing float closestDistance = 280f; - EntityIntersection returnResult = new EntityIntersection(); + EntityIntersection result = new EntityIntersection(); List EntityList = GetEntities(); foreach (EntityBase ent in EntityList) { if (ent is SceneObjectGroup) { SceneObjectGroup reportingG = (SceneObjectGroup)ent; - EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); - if (result.HitTF) + EntityIntersection inter = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); + if (inter.HitTF && inter.distance < closestDistance) { - if (result.distance < closestDistance) - { - closestDistance = result.distance; - returnResult = result; - } + closestDistance = inter.distance; + result = inter; } } } - return returnResult; + return result; } /// @@ -979,7 +976,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) { - if (p.Name==name) + if (p.Name == name) { return p; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c86e4a1..bc3d5c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -555,7 +555,7 @@ namespace OpenSim.Region.Framework.Scenes // If we get a result, we're going to find the closest result to the origin of the ray // and send back the intersection information back to the innerscene. - EntityIntersection returnresult = new EntityIntersection(); + EntityIntersection result = new EntityIntersection(); lock (m_parts) { @@ -576,26 +576,23 @@ namespace OpenSim.Region.Framework.Scenes // when the camera crosses the border. float idist = Constants.RegionSize; - if (inter.HitTF) { // We need to find the closest prim to return to the testcaller along the ray if (inter.distance < idist) { - returnresult.HitTF = true; - returnresult.ipoint = inter.ipoint; - returnresult.obj = part; - returnresult.normal = inter.normal; - returnresult.distance = inter.distance; + result.HitTF = true; + result.ipoint = inter.ipoint; + result.obj = part; + result.normal = inter.normal; + result.distance = inter.distance; } } } } - return returnresult; + return result; } - - /// /// Gets a vector representing the size of the bounding box containing all the prims in the group /// Treats all prims as rectangular, so no shape (cut etc) is taken into account @@ -652,7 +649,6 @@ namespace OpenSim.Region.Framework.Scenes frontBottomRight.Y = orig.Y + (part.Scale.Y / 2); frontBottomRight.Z = orig.Z - (part.Scale.Z / 2); - backTopLeft.X = orig.X + (part.Scale.X / 2); backTopLeft.Y = orig.Y - (part.Scale.Y / 2); backTopLeft.Z = orig.Z + (part.Scale.Z / 2); @@ -839,7 +835,6 @@ namespace OpenSim.Region.Framework.Scenes if (backBottomLeft.Z < minZ) minZ = backBottomLeft.Z; } - } Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); @@ -860,6 +855,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); return boundingBox; } + #endregion public void SaveScriptedState(XmlTextWriter writer) @@ -1029,8 +1025,8 @@ namespace OpenSim.Region.Framework.Scenes //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); //AttachToBackup(); //m_rootPart.ScheduleFullUpdate(); - } + /// /// /// @@ -1130,6 +1126,7 @@ namespace OpenSim.Region.Framework.Scenes } } } + // helper provided for parts. public int GetSceneMaxUndo() { @@ -1183,7 +1180,6 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = GetChildPart(localId); OnGrabPart(part, offsetPos, remoteClient); - } } @@ -1267,28 +1263,10 @@ namespace OpenSim.Region.Framework.Scenes } } - if ((aggregateScriptEvents & scriptEvents.at_target) != 0) - { - m_scriptListens_atTarget = true; - } - else - { - m_scriptListens_atTarget = false; - } - - if ((aggregateScriptEvents & scriptEvents.not_at_target) != 0) - { - m_scriptListens_notAtTarget = true; - } - else - { - m_scriptListens_notAtTarget = false; - } + m_scriptListens_atTarget = ((aggregateScriptEvents & scriptEvents.at_target) != 0); + m_scriptListens_notAtTarget = ((aggregateScriptEvents & scriptEvents.not_at_target) != 0); - if (m_scriptListens_atTarget || m_scriptListens_notAtTarget) - { - } - else + if (!m_scriptListens_atTarget && !m_scriptListens_notAtTarget) { lock (m_targets) m_targets.Clear(); @@ -1787,9 +1765,6 @@ namespace OpenSim.Region.Framework.Scenes } } - - - /// /// Set the owner of the root part. /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3646811..5a74bad 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2710,11 +2710,10 @@ if (m_shape != null) { public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) { - // In this case we're using a sphere with a radius of the largest dimention of the prim + // In this case we're using a sphere with a radius of the largest dimension of the prim // TODO: Change to take shape into account - - EntityIntersection returnresult = new EntityIntersection(); + EntityIntersection result = new EntityIntersection(); Vector3 vAbsolutePosition = AbsolutePosition; Vector3 vScale = Scale; Vector3 rOrigin = iray.Origin; @@ -2738,8 +2737,7 @@ if (m_shape != null) { Vector3 tmVal6 = vAbsolutePosition*rOrigin; - - // Set Radius to the largest dimention of the prim + // Set Radius to the largest dimension of the prim float radius = 0f; if (vScale.X > radius) radius = vScale.X; @@ -2765,7 +2763,7 @@ if (m_shape != null) { if (rootsqr < 0.0f) { // No intersection - return returnresult; + return result; } float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); @@ -2778,7 +2776,7 @@ if (m_shape != null) { if (root < 0.0f) { // nope, no intersection - return returnresult; + return result; } } @@ -2788,12 +2786,12 @@ if (m_shape != null) { new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root), iray.Origin.Z + (iray.Direction.Z*root)); - returnresult.HitTF = true; - returnresult.ipoint = ipoint; + result.HitTF = true; + result.ipoint = ipoint; // Normal is calculated by the difference and then normalizing the result Vector3 normalpart = ipoint - vAbsolutePosition; - returnresult.normal = normalpart / normalpart.Length(); + result.normal = normalpart / normalpart.Length(); // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't. // I can write a function to do it.. but I like the fact that this one is Static. @@ -2802,9 +2800,9 @@ if (m_shape != null) { Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z); float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2); - returnresult.distance = distance; + result.distance = distance; - return returnresult; + return result; } public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) @@ -3008,9 +3006,9 @@ if (m_shape != null) { //distance[i] = (normals[i].X * AmBa.X + normals[i].Y * AmBa.Y + normals[i].Z * AmBa.Z) * -1; } - EntityIntersection returnresult = new EntityIntersection(); + EntityIntersection result = new EntityIntersection(); - returnresult.distance = 1024; + result.distance = 1024; float c = 0; float a = 0; float d = 0; @@ -3030,7 +3028,7 @@ if (m_shape != null) { //{ //if (iray.Origin.Dot(normals[i]) > d) //{ - //return returnresult; + //return result; //} // else //{ @@ -3044,7 +3042,7 @@ if (m_shape != null) { //{ //if (a > fmin) //{ - //return returnresult; + //return result; //} //fmax = a; //} @@ -3056,7 +3054,7 @@ if (m_shape != null) { //{ //if (a < 0 || a < fmax) //{ - //return returnresult; + //return result; //} //fmin = a; //} @@ -3112,17 +3110,17 @@ if (m_shape != null) { // distance2 = (float)GetDistanceTo(q, iray.Origin); //} - if (distance2 < returnresult.distance) + if (distance2 < result.distance) { - returnresult.distance = distance2; - returnresult.HitTF = true; - returnresult.ipoint = q; + result.distance = distance2; + result.HitTF = true; + result.ipoint = q; //m_log.Info("[FACE]:" + i.ToString()); //m_log.Info("[POINT]: " + q.ToString()); //m_log.Info("[DIST]: " + distance2.ToString()); if (faceCenters) { - returnresult.normal = AAfacenormals[i] * AXrot; + result.normal = AAfacenormals[i] * AXrot; Vector3 scaleComponent = AAfacenormals[i]; float ScaleOffset = 0.5f; @@ -3130,20 +3128,20 @@ if (m_shape != null) { if (scaleComponent.Y != 0) ScaleOffset = AXscale.Y; if (scaleComponent.Z != 0) ScaleOffset = AXscale.Z; ScaleOffset = Math.Abs(ScaleOffset); - Vector3 offset = returnresult.normal * ScaleOffset; - returnresult.ipoint = AXpos + offset; + Vector3 offset = result.normal * ScaleOffset; + result.ipoint = AXpos + offset; ///pos = (intersectionpoint + offset); } else { - returnresult.normal = normals[i]; + result.normal = normals[i]; } - returnresult.AAfaceNormal = AAfacenormals[i]; + result.AAfaceNormal = AAfacenormals[i]; } } } - return returnresult; + return result; } /// diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs index 6415250..19f7210 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs @@ -212,6 +212,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule bool Bright { get; set; } // SetPrimParms(FULLBRIGHT) double Bloom { get; set; } // SetPrimParms(GLOW) bool Shiny { get; set; } // SetPrimParms(SHINY) - bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECIATE IN FAVOUR OF UUID?] + bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECATE IN FAVOUR OF UUID?] } } diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 8fdc5a7..b7030f1 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -347,18 +347,13 @@ namespace OpenSim.Region.Physics.OdePlugin #endif } - // zero out a heightmap array float array (single dimention [flattened])) + // zero out a heightmap array float array (single dimension [flattened])) if ((int)Constants.RegionSize == 256) _heightmap = new float[514*514]; else _heightmap = new float[(((int)Constants.RegionSize + 2) * ((int)Constants.RegionSize + 2))]; _watermap = new float[258 * 258]; - - - - - // Zero out the prim spaces array (we split our space into smaller spaces so // we can hit test less. } @@ -2197,7 +2192,7 @@ namespace OpenSim.Region.Physics.OdePlugin } /// - /// Called when a static prim moves. Allocates a space for the prim based on it's position + /// Called when a static prim moves. Allocates a space for the prim based on its position /// /// the pointer to the geom that moved /// the position that the geom moved to @@ -3013,7 +3008,7 @@ namespace OpenSim.Region.Physics.OdePlugin float[] returnarr = new float[262144]; float[,] resultarr = new float[m_regionWidth, m_regionHeight]; - // Filling out the array into it's multi-dimentional components + // Filling out the array into its multi-dimensional components for (int y = 0; y < m_regionHeight; y++) { for (int x = 0; x < m_regionWidth; x++) @@ -3126,7 +3121,7 @@ namespace OpenSim.Region.Physics.OdePlugin float[] returnarr = new float[262144]; float[,] resultarr = new float[m_regionWidth,m_regionHeight]; - // Filling out the array into it's multi-dimentional components + // Filling out the array into its multi-dimensional components for (int y = 0; y < m_regionHeight; y++) { for (int x = 0; x < m_regionWidth; x++) -- cgit v1.1 From 2b630470b064bc4d0fe84210839409f3c7bf5823 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 16 Aug 2009 17:30:13 +0900 Subject: Add copyright headers. Formatting cleanup. --- .../Scripting/Minimodule/ISecurityCredential.cs | 27 ++++++++++++++++++++ .../Scripting/Minimodule/SecurityCredential.cs | 29 +++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs index 464723e..7e084d8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs @@ -1,3 +1,30 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { public interface ISecurityCredential diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs index bd4440c..cbcd137 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using System.Text; -- cgit v1.1 From 975c49a399d2822b93496d7abea8587c9f8c7af4 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 16 Aug 2009 21:20:45 +1000 Subject: * [MRM] Implements permission checks on IObject implementations in SOPObject.cs. Does not implement security on IObjectInventory yet. --- .../Scripting/Minimodule/ISecurityCredential.cs | 2 + .../Scripting/Minimodule/SOPObject.cs | 86 +++++++++++++++++++--- .../Scripting/Minimodule/SecurityCredential.cs | 13 ++++ 3 files changed, 92 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs index 464723e..e6878d1 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs @@ -3,5 +3,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public interface ISecurityCredential { ISocialEntity owner { get; } + bool CanEditObject(IObject target); + bool CanEditTerrain(int x, int y); } } \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index fa9ef53..674c9e0 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Security; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; @@ -68,6 +69,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule return m_rootScene.GetSceneObjectPart(m_localID); } + private bool CanEdit() + { + if(!m_security.CanEditObject(this)) + { + throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]"); + } + return true; + } + #region OnTouch private event OnTouchDelegate _OnTouch; @@ -139,13 +149,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public string Name { get { return GetSOP().Name; } - set { GetSOP().Name = value; } + set + { + if (CanEdit()) + GetSOP().Name = value; + } } public string Description { get { return GetSOP().Description; } - set { GetSOP().Description = value; } + set + { + if (CanEdit()) + GetSOP().Description = value; + } } public IObject[] Children @@ -169,7 +187,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public IObject Root { - get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } + get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId, m_security); } } public IObjectMaterial[] Materials @@ -191,7 +209,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public Vector3 Scale { get { return GetSOP().Scale; } - set { GetSOP().Scale = value; } + set + { + if (CanEdit()) + GetSOP().Scale = value; + } } public Quaternion WorldRotation @@ -211,15 +233,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule get { return GetSOP().AbsolutePosition; } set { - SceneObjectPart pos = GetSOP(); - pos.UpdateOffSet(value - pos.AbsolutePosition); + if (CanEdit()) + { + SceneObjectPart pos = GetSOP(); + pos.UpdateOffSet(value - pos.AbsolutePosition); + } } } public Vector3 OffsetPosition { get { return GetSOP().OffsetPosition; } - set { GetSOP().OffsetPosition = value; } + set + { + if (CanEdit()) + { + GetSOP().OffsetPosition = value; + } + } } public Vector3 SitTarget @@ -319,8 +350,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public void Say(string msg) { - SceneObjectPart sop = GetSOP(); + if (!CanEdit()) + return; + SceneObjectPart sop = GetSOP(); m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false); } @@ -512,6 +545,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule } set { + if (!CanEdit()) + return; + GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z); } } @@ -525,6 +561,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule } set { + if (!CanEdit()) + return; + GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); } } @@ -538,6 +577,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule } set { + if (!CanEdit()) + return; + GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z); } } @@ -560,27 +602,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule } set { + if (!CanEdit()) + return; + GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z); } } public bool FloatOnWater { - set { GetSOP().PhysActor.FloatOnWater = value; } + set + { + if (!CanEdit()) + return; + GetSOP().PhysActor.FloatOnWater = value; + } } public void AddForce(Vector3 force, bool pushforce) { + if (!CanEdit()) + return; + GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); } public void AddAngularForce(Vector3 force, bool pushforce) { + if (!CanEdit()) + return; + GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); } public void SetMomentum(Vector3 momentum) { + if (!CanEdit()) + return; + GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z)); } @@ -595,6 +654,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule get { return m_sculptMap; } set { + if (!CanEdit()) + return; + m_sculptMap = value; SetPrimitiveSculpted(SculptMap, (byte) SculptType); } @@ -607,6 +669,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule get { return m_sculptType; } set { + if(!CanEdit()) + return; + m_sculptType = value; SetPrimitiveSculpted(SculptMap, (byte) SculptType); } @@ -663,6 +728,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public void Play(UUID asset, double volume) { + if (!CanEdit()) + return; + GetSOP().SendSound(asset.ToString(), volume, true, 0); } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs index bd4440c..771bc8b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs @@ -1,12 +1,15 @@ using System; using System.Collections.Generic; using System.Text; +using OpenMetaverse; +using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { class SecurityCredential : ISecurityCredential { private readonly ISocialEntity m_owner; + private readonly Scene m_scene; public SecurityCredential(ISocialEntity m_owner) { @@ -17,5 +20,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { get { return m_owner; } } + + public bool CanEditObject(IObject target) + { + return m_scene.Permissions.CanEditObject(target.GlobalID, m_owner.GlobalID); + } + + public bool CanEditTerrain(int x, int y) + { + return m_scene.Permissions.CanTerraformLand(m_owner.GlobalID, new Vector3(x, y, 0)); + } } } -- cgit v1.1 From 8621dc405e2f0f1ea81baa52ec124d8b362a2abf Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 16 Aug 2009 21:23:39 +1000 Subject: * Fixes potential NulRef in MRM Security Checks. --- OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | 2 +- .../OptionalModules/Scripting/Minimodule/SecurityCredential.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 0cc7930..6daae29 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -169,7 +169,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule // UUID should be changed to object owner. UUID owner = m_scene.RegionInfo.MasterAvatarAssignedUUID; SEUser securityUser = new SEUser(owner, "Name Unassigned"); - SecurityCredential creds = new SecurityCredential(securityUser); + SecurityCredential creds = new SecurityCredential(securityUser, m_scene); world = new World(m_scene, creds); host = new Host(new SOPObject(m_scene, localID, creds), m_scene, new ExtensionHandler(m_extensions), diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs index 6e350b9..bc7f6cb 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -38,9 +38,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule private readonly ISocialEntity m_owner; private readonly Scene m_scene; - public SecurityCredential(ISocialEntity m_owner) + public SecurityCredential(ISocialEntity m_owner, Scene m_scene) { this.m_owner = m_owner; + this.m_scene = m_scene; } public ISocialEntity owner -- cgit v1.1 From adae13cd185b17b4644f2d939b1970aab309097a Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 16 Aug 2009 21:36:33 +1000 Subject: * [MRM] Added permission checks to MRM Events (ie, requires edit permission to bind to OnTouch) --- .../OptionalModules/Scripting/Minimodule/SOPObject.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 674c9e0..2e3ed3c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -87,14 +87,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { add { - if (!_OnTouchActive) + if (CanEdit()) { - GetSOP().Flags |= PrimFlags.Touch; - _OnTouchActive = true; - m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab; + if (!_OnTouchActive) + { + GetSOP().Flags |= PrimFlags.Touch; + _OnTouchActive = true; + m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab; + } + + _OnTouch += value; } - - _OnTouch += value; } remove { -- cgit v1.1 From b28e82654150edd0ef21fc8361c023a99186d658 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 16 Aug 2009 21:41:57 +1000 Subject: * Implements ISecurityCredential on all uses of SOPObject.cs except Avatar Attachments. --- OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | 2 +- OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 2e3ed3c..bdc7a15 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -181,7 +181,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule int i = 0; foreach (KeyValuePair pair in my.ParentGroup.Children) { - rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId); + rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security); } return rets; diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index a34684f..497ca39 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs @@ -146,7 +146,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (chat.Sender == null && chat.SenderObject != null) { ChatEventArgs e = new ChatEventArgs(); - e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId); + e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId, m_security); e.Text = chat.Message; _OnChat(this, e); -- cgit v1.1 From c2be3edd2d8cb2aabb5040d14167c2bed7c4635c Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 16 Aug 2009 21:49:53 +1000 Subject: * Refactor: Moves IAvatarAttachment into IAvatarAttachment.cs instead of IAvatar.cs --- .../Scripting/Minimodule/Interfaces/IAvatar.cs | 13 ------------- .../Scripting/Minimodule/Interfaces/IAvatarAttachment.cs | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs index 849e3ca..03c1e95 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs @@ -32,19 +32,6 @@ using OpenMetaverse; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - public interface IAvatarAttachment - { - //// - /// Describes where on the avatar the attachment is located - /// - int Location { get ; } - - //// - /// Accessor to the rez'ed asset, representing the attachment - /// - IObject Asset { get; } - } - public interface IAvatar : IEntity { //// diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs new file mode 100644 index 0000000..22b4605 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs @@ -0,0 +1,15 @@ +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + public interface IAvatarAttachment + { + //// + /// Describes where on the avatar the attachment is located + /// + int Location { get ; } + + //// + /// Accessor to the rez'ed asset, representing the attachment + /// + IObject Asset { get; } + } +} \ No newline at end of file -- cgit v1.1 From cbd454d69231598daf6748070fb5f0baace61c59 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 16 Aug 2009 22:01:18 +1000 Subject: * Implements ISecurityCredential member on SPAvatar, SPAvatarAttachment * Disables 'event not used' warning for IRCClientView; cuts OpenSim total warnings back. --- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 3 ++- OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | 2 +- OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | 8 ++++++-- .../OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs | 7 +++++-- OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | 6 +++--- 5 files changed, 17 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index a3be181..4a2d7b5 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -634,7 +634,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server { get { return (uint)Util.RandomClass.Next(0,int.MaxValue); } } - +#pragma warning disable 67 public event GenericMessage OnGenericMessage; public event ImprovedInstantMessage OnInstantMessage; public event ChatMessage OnChatFromClient; @@ -826,6 +826,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event AvatarNotesUpdate OnAvatarNotesUpdate; public event MuteListRequest OnMuteListRequest; public event PlacesQuery OnPlacesQuery; +#pragma warning restore 67 public void SetDebugPacketLevel(int newDebug) { diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index bdc7a15..35b0a0f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -117,7 +117,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (_OnTouchActive && m_localID == localID) { TouchEventArgs e = new TouchEventArgs(); - e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId); + e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId, m_security); e.TouchBiNormal = surfaceArgs.Binormal; e.TouchMaterialIndex = surfaceArgs.FaceIndex; e.TouchNormal = surfaceArgs.Normal; diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index ce2d339..4600836 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs @@ -42,11 +42,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { private readonly Scene m_rootScene; private readonly UUID m_ID; + private readonly ISecurityCredential m_security; //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public SPAvatar(Scene scene, UUID ID) + public SPAvatar(Scene scene, UUID ID, ISecurityCredential security) { m_rootScene = scene; + m_security = security; m_ID = ID; } @@ -84,7 +86,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule foreach (DictionaryEntry element in internalAttachments) { Hashtable attachInfo = (Hashtable)element.Value; - attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int)element.Key, new UUID((string)attachInfo["item"]), new UUID((string)attachInfo["asset"]))); + attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int) element.Key, + new UUID((string) attachInfo["item"]), + new UUID((string) attachInfo["asset"]), m_security)); } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs index 9b684fe..570459a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs @@ -39,10 +39,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule private readonly int m_location; //private readonly UUID m_itemId; private readonly UUID m_assetId; + + private readonly ISecurityCredential m_security; - public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId) + public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId, ISecurityCredential security) { m_rootScene = rootScene; + m_security = security; //m_parent = self; m_location = location; //m_itemId = itemId; @@ -55,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { get { - return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId); + return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId, m_security); } } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index 497ca39..da5ea0d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs @@ -86,7 +86,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (_OnNewUser != null) { NewUserEventArgs e = new NewUserEventArgs(); - e.Avatar = new SPAvatar(m_internalScene, presence.UUID); + e.Avatar = new SPAvatar(m_internalScene, presence.UUID, m_security); _OnNewUser(this, e); } } @@ -156,7 +156,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (chat.Sender != null && chat.SenderObject == null) { ChatEventArgs e = new ChatEventArgs(); - e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID); + e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID, m_security); e.Text = chat.Message; _OnChat(this, e); @@ -209,7 +209,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule for (int i = 0; i < ents.Count; i++) { EntityBase ent = ents[i]; - rets[i] = new SPAvatar(m_internalScene, ent.UUID); + rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); } return rets; -- cgit v1.1