Merge branch 'master' into careminster

avinationmerge
Melanie 2010-01-10 04:16:06 +00:00
commit 1676e70dfe
14 changed files with 220 additions and 215 deletions

View File

@ -60,21 +60,6 @@ namespace OpenSim.Client.Linden
m_port = port;
}
protected bool RegionLoginsEnabled
{
get
{
if (m_firstScene != null)
{
return m_firstScene.SceneGridService.RegionLoginsEnabled;
}
else
{
return false;
}
}
}
protected List<Scene> m_scenes = new List<Scene>();
protected Scene m_firstScene;
@ -239,67 +224,53 @@ namespace OpenSim.Client.Linden
agentData.child = false;
}
if (!RegionLoginsEnabled)
{
m_log.InfoFormat(
"[CLIENT]: Denying access for user {0} {1} because region login is currently disabled",
agentData.firstname, agentData.lastname);
bool success = false;
string denyMess = "";
Scene scene;
if (TryGetRegion(regionHandle, out scene))
{
if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID))
{
denyMess = "User is banned from this region";
m_log.InfoFormat(
"[CLIENT]: Denying access for user {0} {1} because user is banned",
agentData.firstname, agentData.lastname);
}
else
{
string reason;
if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
{
success = true;
}
else
{
denyMess = String.Format("Login refused by region: {0}", reason);
m_log.InfoFormat(
"[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region",
agentData.firstname, agentData.lastname);
}
}
}
else
{
denyMess = "Region not found";
}
if (success)
{
Hashtable respdata = new Hashtable();
respdata["success"] = "FALSE";
respdata["reason"] = "region login currently disabled";
respdata["success"] = "TRUE";
resp.Value = respdata;
}
else
{
bool success = false;
string denyMess = "";
Scene scene;
if (TryGetRegion(regionHandle, out scene))
{
if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID))
{
denyMess = "User is banned from this region";
m_log.InfoFormat(
"[CLIENT]: Denying access for user {0} {1} because user is banned",
agentData.firstname, agentData.lastname);
}
else
{
string reason;
if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
{
success = true;
}
else
{
denyMess = String.Format("Login refused by region: {0}", reason);
m_log.InfoFormat(
"[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region",
agentData.firstname, agentData.lastname);
}
}
}
else
{
denyMess = "Region not found";
}
if (success)
{
Hashtable respdata = new Hashtable();
respdata["success"] = "TRUE";
resp.Value = respdata;
}
else
{
Hashtable respdata = new Hashtable();
respdata["success"] = "FALSE";
respdata["reason"] = denyMess;
resp.Value = respdata;
}
Hashtable respdata = new Hashtable();
respdata["success"] = "FALSE";
respdata["reason"] = denyMess;
resp.Value = respdata;
}
}
catch (Exception e)

View File

@ -56,21 +56,6 @@ namespace OpenSim.Client.Linden
protected bool authenticate;
protected string welcomeMessage;
public bool RegionLoginsEnabled
{
get
{
if (m_firstScene != null)
{
return m_firstScene.SceneGridService.RegionLoginsEnabled;
}
else
{
return false;
}
}
}
protected LLStandaloneLoginService m_loginService;
#region IRegionModule Members

View File

@ -202,20 +202,15 @@ namespace OpenSim.Client.Linden
agent.Appearance = new AvatarAppearance(agent.AgentID);
}
if (m_regionsConnector.RegionLoginsEnabled)
string reason;
bool success = m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason);
if (!success)
{
string reason;
bool success = m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason);
if (!success)
{
response.ErrorReason = "key";
response.ErrorMessage = reason;
}
return success;
// return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason);
response.ErrorReason = "key";
response.ErrorMessage = reason;
}
return false;
return success;
// return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent, out reason);
}
public override void LogOffUser(UserProfileData theUser, string message)

View File

@ -388,12 +388,6 @@ namespace OpenSim.Framework.Communications.Tests
}
}
#region ILoginRegionsConnector Members
public bool RegionLoginsEnabled
{
get { return true; }
}
public void LogOffUserFromGrid(ulong regionHandle, OpenMetaverse.UUID AvatarID, OpenMetaverse.UUID RegionSecret, string message)
{
}
@ -454,8 +448,6 @@ namespace OpenSim.Framework.Communications.Tests
return null;
}
#endregion
}
}
}
}

View File

@ -32,7 +32,6 @@ namespace OpenSim.Framework
{
public interface ILoginServiceToRegionsConnector
{
bool RegionLoginsEnabled { get; }
void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message);
bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason);
RegionInfo RequestClosestRegion(string region);

View File

@ -287,18 +287,6 @@ namespace OpenSim
"create region",
"Create a new region", HandleCreateRegion);
m_console.Commands.AddCommand("region", false, "login enable",
"login enable",
"Enable logins to the simulator", HandleLoginEnable);
m_console.Commands.AddCommand("region", false, "login disable",
"login disable",
"Disable logins to the simulator", HandleLoginDisable);
m_console.Commands.AddCommand("region", false, "login status",
"login status",
"Display status of logins", HandleLoginStatus);
m_console.Commands.AddCommand("region", false, "restart",
"restart",
"Restart all sims in this instance", RunCommand);
@ -558,42 +546,6 @@ namespace OpenSim
}
}
/// <summary>
/// Enable logins
/// </summary>
/// <param name="module"></param>
/// <param name="cmd"></param>
private void HandleLoginEnable(string module, string[] cmd)
{
ProcessLogin(true);
}
/// <summary>
/// Disable logins
/// </summary>
/// <param name="module"></param>
/// <param name="cmd"></param>
private void HandleLoginDisable(string module, string[] cmd)
{
ProcessLogin(false);
}
/// <summary>
/// Log login status to the console
/// </summary>
/// <param name="module"></param>
/// <param name="cmd"></param>
private void HandleLoginStatus(string module, string[] cmd)
{
if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false)
m_log.Info("[ Login ] Login are disabled ");
else
m_log.Info("[ Login ] Login are enabled");
}
/// <summary>
/// Change and load configuration file data.
/// </summary>

View File

@ -203,12 +203,6 @@ namespace OpenSim
plugin.PostInitialise();
}
// Only enable logins to the regions once we have completely finished starting up (apart from scripts)
if ((SceneManager.CurrentOrFirstScene != null) && (SceneManager.CurrentOrFirstScene.SceneGridService != null))
{
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
}
AddPluginCommands();
}
@ -278,31 +272,6 @@ namespace OpenSim
m_sceneManager.OnRestartSim += handleRestartRegion;
}
/// <summary>
/// Initialises the asset cache. This supports legacy configuration values
/// to ensure consistent operation, but values outside of that namespace
/// are handled by the more generic resolution mechanism provided by
/// the ResolveAssetServer virtual method. If extended resolution fails,
/// then the normal default action is taken.
/// Creation of the AssetCache is handled by ResolveAssetCache. This
/// function accepts a reference to the instantiated AssetServer and
/// returns an IAssetCache implementation, if possible. This is a virtual
/// method.
/// </summary>
public void ProcessLogin(bool LoginEnabled)
{
if (LoginEnabled)
{
m_log.Info("[LOGIN]: Login is now enabled.");
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true;
}
else
{
m_log.Info("[LOGIN]: Login is now disabled.");
SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = false;
}
}
/// <summary>
/// Execute the region creation process. This includes setting up scene infrastructure.
/// </summary>

View File

@ -55,21 +55,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid
protected bool m_enabled = false; // Module is only enabled if running in standalone mode
public bool RegionLoginsEnabled
{
get
{
if (m_firstScene != null)
{
return m_firstScene.SceneGridService.RegionLoginsEnabled;
}
else
{
return false;
}
}
}
protected HGLoginAuthService m_loginService;
#region IRegionModule Members

View File

@ -47,6 +47,7 @@
<RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" />
<RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \
<RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.HypergridServiceInConnectorModule" /> \
<RegionModule id="AccessModule" type="OpenSim.Region.CoreModules.World.AccessModule" /> \
</Extension>

View File

@ -696,8 +696,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome)
{
comingHome = false;
if (!m_aScene.SceneGridService.RegionLoginsEnabled)
return false;
CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
if (uinfo != null)

View File

@ -0,0 +1,158 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.World
{
public class AccessModule : ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_SceneList = new List<Scene>();
public void Initialise(IConfigSource config)
{
MainConsole.Instance.Commands.AddCommand("access", true,
"login enable",
"login enable",
"Enable simulator logins",
String.Empty,
HandleLoginCommand);
MainConsole.Instance.Commands.AddCommand("access", true,
"login disable",
"login disable",
"Disable simulator logins",
String.Empty,
HandleLoginCommand);
MainConsole.Instance.Commands.AddCommand("access", true,
"login status",
"login status",
"Show login status",
String.Empty,
HandleLoginCommand);
}
public void PostInitialise()
{
}
public void Close()
{
}
public string Name
{
get { return "AccessModule"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
public void AddRegion(Scene scene)
{
if (!m_SceneList.Contains(scene))
m_SceneList.Add(scene);
}
public void RemoveRegion(Scene scene)
{
m_SceneList.Remove(scene);
}
public void RegionLoaded(Scene scene)
{
}
public void HandleLoginCommand(string module, string[] cmd)
{
if ((Scene)MainConsole.Instance.ConsoleScene == null)
{
foreach (Scene s in m_SceneList)
{
if(!ProcessCommand(s, cmd))
break;
}
}
else
{
ProcessCommand((Scene)MainConsole.Instance.ConsoleScene, cmd);
}
}
bool ProcessCommand(Scene scene, string[] cmd)
{
if (cmd.Length < 2)
{
MainConsole.Instance.Output("Syntax: login enable|disable|status");
return false;
}
switch (cmd[1])
{
case "enable":
if (scene.LoginsDisabled)
MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName));
scene.LoginsDisabled = false;
break;
case "disable":
if (!scene.LoginsDisabled)
MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName));
scene.LoginsDisabled = true;
break;
case "status":
if (scene.LoginsDisabled)
MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
else
MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName));
break;
default:
MainConsole.Instance.Output("Syntax: login enable|disable|status");
return false;
}
return true;
}
}
}

View File

@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes
public CommunicationsManager CommsManager;
protected SceneCommunicationService m_sceneGridService;
public bool loginsdisabled = true;
public bool LoginsDisabled = true;
public new float TimeDilation
{
@ -1289,15 +1289,19 @@ namespace OpenSim.Region.Framework.Scenes
StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
}
if (loginsdisabled && m_frame > 20)
if (LoginsDisabled && m_frame == 20)
{
// In 99.9% of cases it is a bad idea to manually force garbage collection. However,
// this is a rare case where we know we have just went through a long cycle of heap
// allocations, and there is no more work to be done until someone logs in
GC.Collect();
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
loginsdisabled = false;
IConfig startupConfig = m_config.Configs["Startup"];
if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
{
m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
LoginsDisabled = false;
}
}
}
catch (NotImplementedException)
@ -3375,7 +3379,7 @@ namespace OpenSim.Region.Framework.Scenes
// TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
if (loginsdisabled)
if (LoginsDisabled)
{
reason = "Logins Disabled";
return false;

View File

@ -65,13 +65,6 @@ namespace OpenSim.Region.Framework.Scenes
protected List<UUID> m_agentsInTransit;
public bool RegionLoginsEnabled
{
get { return m_regionLoginsEnabled; }
set { m_regionLoginsEnabled = value; }
}
private bool m_regionLoginsEnabled = false;
/// <summary>
/// An agent is crossing into this region
/// </summary>

View File

@ -268,6 +268,9 @@
; Enable JSON simulator data by setting a URI name (case sensitive)
; Stats_URI = "jsonSimStats"
; Make OpenSim start all regions woth logins disabled. They will need
; to be enabled from the console if this is set
; StartDisabled = false
[SMTP]
enabled=false