implement serverside checks for media texture navigation in order to stop naughty clients

prebuild-update
Justin Clark-Casey (justincc) 2010-07-13 23:58:19 +01:00
parent a9101feb10
commit ee6cd884c9
3 changed files with 52 additions and 8 deletions

View File

@ -245,12 +245,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
for (int i = 0; i < omu.FaceMedia.Length; i++) // for (int i = 0; i < omu.FaceMedia.Length; i++)
{ // {
MediaEntry me = omu.FaceMedia[i]; // MediaEntry me = omu.FaceMedia[i];
string v = (null == me ? "null": OSDParser.SerializeLLSDXmlString(me.GetOSD())); // string v = (null == me ? "null": OSDParser.SerializeLLSDXmlString(me.GetOSD()));
m_log.DebugFormat("[MOAP]: Face {0} [{1}]", i, v); // m_log.DebugFormat("[MOAP]: Face {0} [{1}]", i, v);
} // }
if (omu.FaceMedia.Length > part.GetNumberOfSides()) if (omu.FaceMedia.Length > part.GetNumberOfSides())
{ {
@ -322,6 +322,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap
return string.Empty; return string.Empty;
} }
UUID agentId = default(UUID);
lock (m_omuCapUsers)
agentId = m_omuCapUsers[path];
if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face))
return string.Empty;
m_log.DebugFormat( m_log.DebugFormat(
"[MOAP]: Updating media entry for face {0} on prim {1} {2} to {3}", "[MOAP]: Updating media entry for face {0} on prim {1} {2} to {3}",
omn.Face, part.Name, part.UUID, omn.URL); omn.Face, part.Name, part.UUID, omn.URL);

View File

@ -251,6 +251,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
m_scene.AddCommand(this, "bypass permissions", m_scene.AddCommand(this, "bypass permissions",
"bypass permissions <true / false>", "bypass permissions <true / false>",
@ -1915,7 +1916,25 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true; return true;
return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); return GenericPrimMediaPermission(part, agentID, me.ControlPermissions);
} }
private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
{
if (null == m_moapModule)
return false;
SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
if (null == part)
return false;
MediaEntry me = m_moapModule.GetMediaEntry(part, face);
// If there is no existing media entry then it can be controlled (in this context, created).
if (null == me)
return true;
return GenericPrimMediaPermission(part, agentID, me.InteractPermissions);
}
private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms) private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms)
{ {

View File

@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
public delegate bool TeleportHandler(UUID userID, Scene scene); public delegate bool TeleportHandler(UUID userID, Scene scene);
public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face);
public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face);
#endregion #endregion
public class ScenePermissions public class ScenePermissions
@ -141,6 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
public event DeleteUserInventoryHandler OnDeleteUserInventory; public event DeleteUserInventoryHandler OnDeleteUserInventory;
public event TeleportHandler OnTeleport; public event TeleportHandler OnTeleport;
public event ControlPrimMediaHandler OnControlPrimMedia; public event ControlPrimMediaHandler OnControlPrimMedia;
public event InteractWithPrimMediaHandler OnInteractWithPrimMedia;
#endregion #endregion
#region Object Permission Checks #region Object Permission Checks
@ -963,6 +965,21 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
return true; return true;
} }
public bool CanInteractWithPrimMedia(UUID userID, UUID primID, int face)
{
InteractWithPrimMediaHandler handler = OnInteractWithPrimMedia;
if (handler != null)
{
Delegate[] list = handler.GetInvocationList();
foreach (InteractWithPrimMediaHandler h in list)
{
if (h(userID, primID, face) == false)
return false;
}
}
return true;
}
} }
} }