From 3399596e0e2df2d0e260ba88ce8a0166de8cbff2 Mon Sep 17 00:00:00 2001 From: Michelle Argus Date: Mon, 2 Jul 2012 19:12:10 +0200 Subject: Adds a list of viewers that are allowed or banned from the region. Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/Scene.cs | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 293c72a..2493df1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -120,6 +120,9 @@ namespace OpenSim.Region.Framework.Scenes { get { return m_defaultDrawDistance; } } + + private List m_AllowedViewers = new List(); + private List m_BanedViewers = new List(); // TODO: need to figure out how allow client agents but deny // root agents when ACL denies access to root agent @@ -779,6 +782,24 @@ namespace OpenSim.Region.Framework.Scenes } } + string grant = startupConfig.GetString("AllowedViewerList", String.Empty); + if (grant.Length > 0) + { + foreach (string viewer in grant.Split(',')) + { + m_AllowedViewers.Add(viewer.Trim().ToLower()); + } + } + + grant = startupConfig.GetString("BannedViewerList", String.Empty); + if (grant.Length > 0) + { + foreach (string viewer in grant.Split(',')) + { + m_BanedViewers.Add(viewer.Trim().ToLower()); + } + } + MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); @@ -3417,6 +3438,50 @@ namespace OpenSim.Region.Framework.Scenes return false; } + //Check if the viewer is banned or in the viewer access list + //We check if the substring is listed for higher flexebility + bool ViewerDenied = true; + + //Check if the specific viewer is listed in the allowed viewer list + if (m_AllowedViewers.Count > 0) + { + foreach (string viewer in m_AllowedViewers) + { + if (viewer == agent.Viewer.Substring(0, viewer.Length).Trim().ToLower()) + { + ViewerDenied = false; + break; + } + } + } + else + { + ViewerDenied = false; + } + + //Check if the viewer is in the banned list + if (m_BanedViewers.Count > 0) + { + foreach (string viewer in m_BanedViewers) + { + if (viewer == agent.Viewer.Substring(0, viewer.Length).Trim().ToLower()) + { + ViewerDenied = true; + break; + } + } + } + + if (ViewerDenied) + { + m_log.DebugFormat( + "[SCENE]: Access denied for {0} {1} using {2}", + agent.firstname, agent.lastname, agent.Viewer); + reason = "Access denied, your viewer is banned by the region owner"; + return false; + } + + ScenePresence sp = GetScenePresence(agent.AgentID); if (sp != null && !sp.IsChildAgent) -- cgit v1.1