implement serverside checks for media texture navigation in order to stop naughty clients
parent
a9101feb10
commit
ee6cd884c9
|
@ -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);
|
||||
|
||||
for (int i = 0; i < omu.FaceMedia.Length; i++)
|
||||
{
|
||||
MediaEntry me = omu.FaceMedia[i];
|
||||
string v = (null == me ? "null": OSDParser.SerializeLLSDXmlString(me.GetOSD()));
|
||||
m_log.DebugFormat("[MOAP]: Face {0} [{1}]", i, v);
|
||||
}
|
||||
// for (int i = 0; i < omu.FaceMedia.Length; i++)
|
||||
// {
|
||||
// MediaEntry me = omu.FaceMedia[i];
|
||||
// string v = (null == me ? "null": OSDParser.SerializeLLSDXmlString(me.GetOSD()));
|
||||
// m_log.DebugFormat("[MOAP]: Face {0} [{1}]", i, v);
|
||||
// }
|
||||
|
||||
if (omu.FaceMedia.Length > part.GetNumberOfSides())
|
||||
{
|
||||
|
@ -322,6 +322,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap
|
|||
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(
|
||||
"[MOAP]: Updating media entry for face {0} on prim {1} {2} to {3}",
|
||||
omn.Face, part.Name, part.UUID, omn.URL);
|
||||
|
|
|
@ -251,6 +251,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
|
||||
|
||||
m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
|
||||
m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
|
||||
|
||||
m_scene.AddCommand(this, "bypass permissions",
|
||||
"bypass permissions <true / false>",
|
||||
|
@ -1917,6 +1918,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
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)
|
||||
{
|
||||
if (IsAdministrator(agentID))
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID);
|
||||
public delegate bool TeleportHandler(UUID userID, Scene scene);
|
||||
public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face);
|
||||
public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face);
|
||||
#endregion
|
||||
|
||||
public class ScenePermissions
|
||||
|
@ -141,6 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event DeleteUserInventoryHandler OnDeleteUserInventory;
|
||||
public event TeleportHandler OnTeleport;
|
||||
public event ControlPrimMediaHandler OnControlPrimMedia;
|
||||
public event InteractWithPrimMediaHandler OnInteractWithPrimMedia;
|
||||
#endregion
|
||||
|
||||
#region Object Permission Checks
|
||||
|
@ -964,5 +966,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue