Adds a list of viewers that are allowed or banned from the region.

Signed-off-by: Melanie <melanie@t-data.com>
0.7.4.1
Michelle Argus 2012-07-02 19:12:10 +02:00 committed by Melanie
parent d32cf21576
commit 3399596e0e
2 changed files with 82 additions and 0 deletions

View File

@ -120,6 +120,9 @@ namespace OpenSim.Region.Framework.Scenes
{
get { return m_defaultDrawDistance; }
}
private List<string> m_AllowedViewers = new List<string>();
private List<string> m_BanedViewers = new List<string>();
// 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)

17
bin/OpenSim.ini.example Executable file → Normal file
View File

@ -254,6 +254,23 @@
;; default is false
; TelehubAllowLandmark = false
;# Comma separated list of viewers which may gain access to the regions.
;; One can use a Substring of the viewer name to enable only certain subversions
;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
;; - "Imprudence" has access
;; - "Imprudence 1.3" has access
;; - "Imprudence 1.3.1" has no access
;; AllowedViewerList =
;# Comma separated list of viewers which may not gain access to the regions.
;; One can use a Substring of the viewer name to disable only certain subversions
;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
;; - "Imprudence" has no access
;; - "Imprudence 1.3" has no access
;; - "Imprudence 1.3.1" has access
; BannedViewerList =
[Estates]
; If these values are commented out then the user will be asked for estate details when required (this is the normal case).
; If these values are uncommented then they will be used to create a default estate as necessary.