aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-13 23:58:19 +0100
committerJustin Clark-Casey (justincc)2010-07-13 23:58:19 +0100
commita4c6c4de9114497de831594e5673788d323d8e65 (patch)
tree7a05c035f2368155079c8c9b6699cd7e0848f5af
parentfactor out soon to be common media permissions check code (diff)
downloadopensim-SC_OLD-a4c6c4de9114497de831594e5673788d323d8e65.zip
opensim-SC_OLD-a4c6c4de9114497de831594e5673788d323d8e65.tar.gz
opensim-SC_OLD-a4c6c4de9114497de831594e5673788d323d8e65.tar.bz2
opensim-SC_OLD-a4c6c4de9114497de831594e5673788d323d8e65.tar.xz
implement serverside checks for media texture navigation in order to stop naughty clients
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs19
3 files changed, 52 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index d7aede9..09786ec 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -245,12 +245,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
245 245
246 m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); 246 m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
247 247
248 for (int i = 0; i < omu.FaceMedia.Length; i++) 248// for (int i = 0; i < omu.FaceMedia.Length; i++)
249 { 249// {
250 MediaEntry me = omu.FaceMedia[i]; 250// MediaEntry me = omu.FaceMedia[i];
251 string v = (null == me ? "null": OSDParser.SerializeLLSDXmlString(me.GetOSD())); 251// string v = (null == me ? "null": OSDParser.SerializeLLSDXmlString(me.GetOSD()));
252 m_log.DebugFormat("[MOAP]: Face {0} [{1}]", i, v); 252// m_log.DebugFormat("[MOAP]: Face {0} [{1}]", i, v);
253 } 253// }
254 254
255 if (omu.FaceMedia.Length > part.GetNumberOfSides()) 255 if (omu.FaceMedia.Length > part.GetNumberOfSides())
256 { 256 {
@@ -322,6 +322,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap
322 return string.Empty; 322 return string.Empty;
323 } 323 }
324 324
325 UUID agentId = default(UUID);
326
327 lock (m_omuCapUsers)
328 agentId = m_omuCapUsers[path];
329
330 if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face))
331 return string.Empty;
332
325 m_log.DebugFormat( 333 m_log.DebugFormat(
326 "[MOAP]: Updating media entry for face {0} on prim {1} {2} to {3}", 334 "[MOAP]: Updating media entry for face {0} on prim {1} {2} to {3}",
327 omn.Face, part.Name, part.UUID, omn.URL); 335 omn.Face, part.Name, part.UUID, omn.URL);
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 2344e96..3a690af 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -251,6 +251,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
251 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED 251 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
252 252
253 m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; 253 m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
254 m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
254 255
255 m_scene.AddCommand(this, "bypass permissions", 256 m_scene.AddCommand(this, "bypass permissions",
256 "bypass permissions <true / false>", 257 "bypass permissions <true / false>",
@@ -1915,7 +1916,25 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1915 return true; 1916 return true;
1916 1917
1917 return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); 1918 return GenericPrimMediaPermission(part, agentID, me.ControlPermissions);
1918 } 1919 }
1920
1921 private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
1922 {
1923 if (null == m_moapModule)
1924 return false;
1925
1926 SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
1927 if (null == part)
1928 return false;
1929
1930 MediaEntry me = m_moapModule.GetMediaEntry(part, face);
1931
1932 // If there is no existing media entry then it can be controlled (in this context, created).
1933 if (null == me)
1934 return true;
1935
1936 return GenericPrimMediaPermission(part, agentID, me.InteractPermissions);
1937 }
1919 1938
1920 private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms) 1939 private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms)
1921 { 1940 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 70af978..0033900 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
82 public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); 82 public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
83 public delegate bool TeleportHandler(UUID userID, Scene scene); 83 public delegate bool TeleportHandler(UUID userID, Scene scene);
84 public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); 84 public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face);
85 public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face);
85 #endregion 86 #endregion
86 87
87 public class ScenePermissions 88 public class ScenePermissions
@@ -141,6 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
141 public event DeleteUserInventoryHandler OnDeleteUserInventory; 142 public event DeleteUserInventoryHandler OnDeleteUserInventory;
142 public event TeleportHandler OnTeleport; 143 public event TeleportHandler OnTeleport;
143 public event ControlPrimMediaHandler OnControlPrimMedia; 144 public event ControlPrimMediaHandler OnControlPrimMedia;
145 public event InteractWithPrimMediaHandler OnInteractWithPrimMedia;
144 #endregion 146 #endregion
145 147
146 #region Object Permission Checks 148 #region Object Permission Checks
@@ -963,6 +965,21 @@ namespace OpenSim.Region.Framework.Scenes
963 } 965 }
964 } 966 }
965 return true; 967 return true;
966 } 968 }
969
970 public bool CanInteractWithPrimMedia(UUID userID, UUID primID, int face)
971 {
972 InteractWithPrimMediaHandler handler = OnInteractWithPrimMedia;
973 if (handler != null)
974 {
975 Delegate[] list = handler.GetInvocationList();
976 foreach (InteractWithPrimMediaHandler h in list)
977 {
978 if (h(userID, primID, face) == false)
979 return false;
980 }
981 }
982 return true;
983 }
967 } 984 }
968} \ No newline at end of file 985} \ No newline at end of file