A few more inches... Old friends things removed. Less references to UserProfileService.

slimupdates
Diva Canto 2010-01-08 20:31:29 -08:00
parent d14589d1ab
commit 6b60f3cce5
13 changed files with 20 additions and 1500 deletions

View File

@ -591,24 +591,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar
{ {
// no client supplied UUID: look it up... // no client supplied UUID: look it up...
CachedUserInfo userInfo UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
= m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails( UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, masterFirst, masterLast);
masterFirst, masterLast); if (null == account)
if (null == userInfo)
{ {
m_log.InfoFormat("master avatar does not exist, creating it"); m_log.InfoFormat("master avatar does not exist, creating it");
// ...or create new user // ...or create new user
userID = m_app.CommunicationsManager.UserAdminService.AddUser(
masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
if (userID == UUID.Zero) account = new UserAccount(scopeID, masterFirst, masterLast, "");
bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
if (success)
{
GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
(int)(region.RegionLocX * Constants.RegionSize), (int)(region.RegionLocY * Constants.RegionSize));
m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
}
else
throw new Exception(String.Format("failed to create new user {0} {1}", throw new Exception(String.Format("failed to create new user {0} {1}",
masterFirst, masterLast)); masterFirst, masterLast));
} }
else else
{ {
userID = userInfo.UserProfile.ID; userID = account.PrincipalID;
} }
} }
} }
@ -2591,10 +2597,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
foreach (UUID user in acl) foreach (UUID user in acl)
{ {
CachedUserInfo udata = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(user); UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
if (udata != null) UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user);
if (account != null)
{ {
users[user.ToString()] = udata.UserProfile.Name; users[user.ToString()] = account.FirstName + " " + account.LastName;
} }
} }

View File

@ -1,364 +0,0 @@
/*
* 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;
using System.Collections.Generic;
using System.Text;
using Nwc.XmlRpc;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Security.Authentication;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Client.Linden
{
/// <summary>
/// Handles login user (expect user) and logoff user messages from the remote LL login server
/// </summary>
public class LLProxyLoginModule : ISharedRegionModule
{
private uint m_port = 0;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public LLProxyLoginModule(uint port)
{
m_log.DebugFormat("[CLIENT]: LLProxyLoginModule port {0}", port);
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;
protected bool m_enabled = false; // Module is only enabled if running in grid mode
#region IRegionModule Members
public void Initialise(IConfigSource source)
{
IConfig startupConfig = source.Configs["Modules"];
if (startupConfig != null)
{
m_enabled = startupConfig.GetBoolean("LLProxyLoginModule", false);
}
}
public void AddRegion(Scene scene)
{
if (m_firstScene == null)
{
m_firstScene = scene;
if (m_enabled)
{
AddHttpHandlers();
}
}
if (m_enabled)
{
AddScene(scene);
}
}
public void RemoveRegion(Scene scene)
{
if (m_enabled)
{
RemoveScene(scene);
}
}
public void PostInitialise()
{
}
public void Close()
{
}
public void RegionLoaded(Scene scene)
{
}
public Type ReplaceableInterface
{
get { return null; }
}
public string Name
{
get { return "LLProxyLoginModule"; }
}
public bool IsSharedModule
{
get { return true; }
}
#endregion
/// <summary>
/// Adds "expect_user" and "logoff_user" xmlrpc method handlers
/// </summary>
protected void AddHttpHandlers()
{
//we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change?
MainServer.GetHttpServer(m_port).AddXmlRPCHandler("expect_user", ExpectUser, false);
MainServer.GetHttpServer(m_port).AddXmlRPCHandler("logoff_user", LogOffUser, false);
}
protected void AddScene(Scene scene)
{
lock (m_scenes)
{
if (!m_scenes.Contains(scene))
{
m_scenes.Add(scene);
}
}
}
protected void RemoveScene(Scene scene)
{
lock (m_scenes)
{
if (m_scenes.Contains(scene))
{
m_scenes.Remove(scene);
}
}
}
/// <summary>
/// Received from the user server when a user starts logging in. This call allows
/// the region to prepare for direct communication from the client. Sends back an empty
/// xmlrpc response on completion.
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public XmlRpcResponse ExpectUser(XmlRpcRequest request, IPEndPoint remoteClient)
{
XmlRpcResponse resp = new XmlRpcResponse();
try
{
ulong regionHandle = 0;
Hashtable requestData = (Hashtable)request.Params[0];
AgentCircuitData agentData = new AgentCircuitData();
if (requestData.ContainsKey("session_id"))
agentData.SessionID = new UUID((string)requestData["session_id"]);
if (requestData.ContainsKey("secure_session_id"))
agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]);
if (requestData.ContainsKey("firstname"))
agentData.firstname = (string)requestData["firstname"];
if (requestData.ContainsKey("lastname"))
agentData.lastname = (string)requestData["lastname"];
if (requestData.ContainsKey("agent_id"))
agentData.AgentID = new UUID((string)requestData["agent_id"]);
if (requestData.ContainsKey("circuit_code"))
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
if (requestData.ContainsKey("caps_path"))
agentData.CapsPath = (string)requestData["caps_path"];
if (requestData.ContainsKey("regionhandle"))
regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
else
m_log.Warn("[CLIENT]: request from login server did not contain regionhandle");
// Appearance
if (requestData.ContainsKey("appearance"))
agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]);
m_log.DebugFormat(
"[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}",
agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode);
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
{
//m_log.Debug("[CLIENT]: Child agent detected");
agentData.child = true;
}
else
{
//m_log.Debug("[CLIENT]: Main agent detected");
agentData.startpos =
new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]),
(float)Convert.ToDecimal((string)requestData["startpos_y"]),
(float)Convert.ToDecimal((string)requestData["startpos_z"]));
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);
Hashtable respdata = new Hashtable();
respdata["success"] = "FALSE";
respdata["reason"] = "region login currently disabled";
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;
}
}
}
catch (Exception e)
{
m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0} ({1})", e, e.StackTrace);
Hashtable respdata = new Hashtable();
respdata["success"] = "FALSE";
respdata["reason"] = "Exception occurred";
resp.Value = respdata;
}
return resp;
}
// Grid Request Processing
/// <summary>
/// Ooops, our Agent must be dead if we're getting this request!
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public XmlRpcResponse LogOffUser(XmlRpcRequest request, IPEndPoint remoteClient)
{
m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called");
Hashtable requestData = (Hashtable)request.Params[0];
string message = (string)requestData["message"];
UUID agentID = UUID.Zero;
UUID RegionSecret = UUID.Zero;
UUID.TryParse((string)requestData["agent_id"], out agentID);
UUID.TryParse((string)requestData["region_secret"], out RegionSecret);
ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
Scene scene;
if (TryGetRegion(regionHandle, out scene))
{
scene.HandleLogOffUserFromGrid(agentID, RegionSecret, message);
}
return new XmlRpcResponse();
}
protected bool TryGetRegion(ulong regionHandle, out Scene scene)
{
lock (m_scenes)
{
foreach (Scene nextScene in m_scenes)
{
if (nextScene.RegionInfo.RegionHandle == regionHandle)
{
scene = nextScene;
return true;
}
}
}
scene = null;
return false;
}
}
}

View File

@ -1,305 +0,0 @@
/*
* 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;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Text.RegularExpressions;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Client.Linden
{
public class LLStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector
{
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected List<Scene> m_scenes = new List<Scene>();
protected Scene m_firstScene;
protected bool m_enabled = false; // Module is only enabled if running in standalone mode
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
public void Initialise(IConfigSource source)
{
IConfig startupConfig = source.Configs["Startup"];
if (startupConfig != null)
{
m_enabled = !startupConfig.GetBoolean("gridmode", false);
}
if (m_enabled)
{
authenticate = true;
welcomeMessage = "Welcome to OpenSim";
IConfig standaloneConfig = source.Configs["StandAlone"];
if (standaloneConfig != null)
{
authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
welcomeMessage = standaloneConfig.GetString("welcome_message");
}
}
}
public void AddRegion(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
if (m_enabled)
{
RemoveScene(scene);
}
}
public void PostInitialise()
{
}
public void Close()
{
}
public void RegionLoaded(Scene scene)
{
if (m_firstScene == null)
{
m_firstScene = scene;
if (m_enabled)
{
//TODO: fix casting.
LibraryRootFolder rootFolder
= m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;
IHttpServer httpServer = MainServer.Instance;
//TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
m_loginService
= new LLStandaloneLoginService(
(UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage,
m_firstScene.InventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate,
rootFolder, this);
httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
// provides the web form login
httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
// Provides the LLSD login
httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
}
}
if (m_enabled)
{
AddScene(scene);
}
}
public Type ReplaceableInterface
{
get { return null; }
}
public string Name
{
get { return "LLStandaloneLoginModule"; }
}
public bool IsSharedModule
{
get { return true; }
}
#endregion
protected void AddScene(Scene scene)
{
lock (m_scenes)
{
if (!m_scenes.Contains(scene))
{
m_scenes.Add(scene);
}
}
}
protected void RemoveScene(Scene scene)
{
lock (m_scenes)
{
if (m_scenes.Contains(scene))
{
m_scenes.Remove(scene);
}
}
}
public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason)
{
Scene scene;
if (TryGetRegion(regionHandle, out scene))
{
return scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
}
reason = "Region not found.";
return false;
}
public void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message)
{
Scene scene;
if (TryGetRegion(regionHandle, out scene))
{
scene.HandleLogOffUserFromGrid(AvatarID, RegionSecret, message);
}
}
public RegionInfo RequestNeighbourInfo(ulong regionhandle)
{
Scene scene;
if (TryGetRegion(regionhandle, out scene))
{
return scene.RegionInfo;
}
return null;
}
public RegionInfo RequestClosestRegion(string region)
{
Scene scene;
if (TryGetRegion(region, out scene))
{
return scene.RegionInfo;
}
else if (m_scenes.Count > 0)
{
return m_scenes[0].RegionInfo;
}
return null;
}
public RegionInfo RequestNeighbourInfo(UUID regionID)
{
Scene scene;
if (TryGetRegion(regionID, out scene))
{
return scene.RegionInfo;
}
return null;
}
protected bool TryGetRegion(ulong regionHandle, out Scene scene)
{
lock (m_scenes)
{
foreach (Scene nextScene in m_scenes)
{
if (nextScene.RegionInfo.RegionHandle == regionHandle)
{
scene = nextScene;
return true;
}
}
}
scene = null;
return false;
}
protected bool TryGetRegion(UUID regionID, out Scene scene)
{
lock (m_scenes)
{
foreach (Scene nextScene in m_scenes)
{
if (nextScene.RegionInfo.RegionID == regionID)
{
scene = nextScene;
return true;
}
}
}
scene = null;
return false;
}
protected bool TryGetRegion(string regionName, out Scene scene)
{
lock (m_scenes)
{
foreach (Scene nextScene in m_scenes)
{
if (nextScene.RegionInfo.RegionName.Equals(regionName, StringComparison.InvariantCultureIgnoreCase))
{
scene = nextScene;
return true;
}
}
}
scene = null;
return false;
}
}
}

View File

@ -1,245 +0,0 @@
/*
* 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;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Text.RegularExpressions;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Services;
using LoginResponse = OpenSim.Framework.Communications.Services.LoginResponse;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
namespace OpenSim.Client.Linden
{
public class LLStandaloneLoginService : LoginService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected NetworkServersInfo m_serversInfo;
protected bool m_authUsers = false;
/// <summary>
/// Used to make requests to the local regions.
/// </summary>
protected ILoginServiceToRegionsConnector m_regionsConnector;
public LLStandaloneLoginService(
UserManagerBase userManager, string welcomeMess,
IInventoryService interServiceInventoryService,
NetworkServersInfo serversInfo,
bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
: base(userManager, libraryRootFolder, welcomeMess)
{
this.m_serversInfo = serversInfo;
m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX;
m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY;
m_authUsers = authenticate;
m_InventoryService = interServiceInventoryService;
m_regionsConnector = regionsConnector;
// Standard behavior: In StandAlone, silent logout of last hung session
m_warn_already_logged = false;
}
public override UserProfileData GetTheUser(string firstname, string lastname)
{
UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname);
if (profile != null)
{
return profile;
}
if (!m_authUsers)
{
//no current user account so make one
m_log.Info("[LOGIN]: No user account found so creating a new one.");
m_userManager.AddUser(firstname, lastname, "test", "", m_defaultHomeX, m_defaultHomeY);
return m_userManager.GetUserProfile(firstname, lastname);
}
return null;
}
public override bool AuthenticateUser(UserProfileData profile, string password)
{
if (!m_authUsers)
{
//for now we will accept any password in sandbox mode
m_log.Info("[LOGIN]: Authorising user (no actual password check)");
return true;
}
else
{
m_log.Info(
"[LOGIN]: Authenticating " + profile.FirstName + " " + profile.SurName);
if (!password.StartsWith("$1$"))
password = "$1$" + Util.Md5Hash(password);
password = password.Remove(0, 3); //remove $1$
string s = Util.Md5Hash(password + ":" + profile.PasswordSalt);
bool loginresult = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|| profile.PasswordHash.Equals(password, StringComparison.InvariantCulture));
return loginresult;
}
}
protected override RegionInfo RequestClosestRegion(string region)
{
return m_regionsConnector.RequestClosestRegion(region);
}
protected override RegionInfo GetRegionInfo(ulong homeRegionHandle)
{
return m_regionsConnector.RequestNeighbourInfo(homeRegionHandle);
}
protected override RegionInfo GetRegionInfo(UUID homeRegionId)
{
return m_regionsConnector.RequestNeighbourInfo(homeRegionId);
}
protected override bool PrepareLoginToRegion(
RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)
{
IPEndPoint endPoint = regionInfo.ExternalEndPoint;
response.SimAddress = endPoint.Address.ToString();
response.SimPort = (uint)endPoint.Port;
response.RegionX = regionInfo.RegionLocX;
response.RegionY = regionInfo.RegionLocY;
string capsPath = CapsUtil.GetRandomCapsObjectPath();
string capsSeedPath = CapsUtil.GetCapsSeedPath(capsPath);
// Don't use the following! It Fails for logging into any region not on the same port as the http server!
// Kept here so it doesn't happen again!
// response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
string seedcap = "http://";
if (m_serversInfo.HttpUsesSSL)
{
// For NAT
string host = NetworkUtil.GetHostFor(remoteClient.Address, m_serversInfo.HttpSSLCN);
seedcap = "https://" + host + ":" + m_serversInfo.httpSSLPort + capsSeedPath;
}
else
{
// For NAT
string host = NetworkUtil.GetHostFor(remoteClient.Address, regionInfo.ExternalHostName);
seedcap = "http://" + host + ":" + m_serversInfo.HttpListenerPort + capsSeedPath;
}
response.SeedCapability = seedcap;
// Notify the target of an incoming user
m_log.InfoFormat(
"[LOGIN]: Telling {0} @ {1},{2} ({3}) to prepare for client connection",
regionInfo.RegionName, response.RegionX, response.RegionY, regionInfo.ServerURI);
// Update agent with target sim
user.CurrentAgent.Region = regionInfo.RegionID;
user.CurrentAgent.Handle = regionInfo.RegionHandle;
AgentCircuitData agent = new AgentCircuitData();
agent.AgentID = user.ID;
agent.firstname = user.FirstName;
agent.lastname = user.SurName;
agent.SessionID = user.CurrentAgent.SessionID;
agent.SecureSessionID = user.CurrentAgent.SecureSessionID;
agent.circuitcode = Convert.ToUInt32(response.CircuitCode);
agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero;
agent.startpos = user.CurrentAgent.Position;
agent.CapsPath = capsPath;
agent.Appearance = m_userManager.GetUserAppearance(user.ID);
if (agent.Appearance == null)
{
m_log.WarnFormat(
"[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
agent.Appearance = new AvatarAppearance(agent.AgentID);
}
if (m_regionsConnector.RegionLoginsEnabled)
{
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);
}
return false;
}
public override void LogOffUser(UserProfileData theUser, string message)
{
RegionInfo SimInfo;
try
{
SimInfo = this.m_regionsConnector.RequestNeighbourInfo(theUser.CurrentAgent.Handle);
if (SimInfo == null)
{
m_log.Error("[LOCAL LOGIN]: Region user was in isn't currently logged in");
return;
}
}
catch (Exception)
{
m_log.Error("[LOCAL LOGIN]: Unable to look up region to log user off");
return;
}
m_regionsConnector.LogOffUserFromGrid(
SimInfo.RegionHandle, theUser.ID, theUser.CurrentAgent.SecureSessionID, "Logging you off");
}
}
}

View File

@ -8,10 +8,6 @@
</Dependencies> </Dependencies>
<Extension path = "/OpenSim/RegionModules"> <Extension path = "/OpenSim/RegionModules">
<!--
<RegionModule id="LLStandaloneLoginModule" type="OpenSim.Client.Linden.LLStandaloneLoginModule" />
<RegionModule id="LLProxyLoginModule" type="OpenSim.Client.Linden.LLProxyLoginModule" />
-->
<RegionModule id="LLClientStackModule" type="OpenSim.Client.Linden.LLClientStackModule" /> <RegionModule id="LLClientStackModule" type="OpenSim.Client.Linden.LLClientStackModule" />
</Extension> </Extension>
</Addin> </Addin>

View File

@ -53,13 +53,6 @@ namespace OpenSim.Framework.Communications
} }
protected IUserService m_userService; protected IUserService m_userService;
public IMessagingService MessageService
{
get { return m_messageService; }
}
protected IMessagingService m_messageService;
public UserProfileCacheService UserProfileCacheService public UserProfileCacheService UserProfileCacheService
{ {
get { return m_userProfileCacheService; } get { return m_userProfileCacheService; }
@ -105,18 +98,6 @@ namespace OpenSim.Framework.Communications
} }
#region Friend Methods
/// <summary>
/// Adds a new friend to the database for XUser
/// </summary>
/// <param name="friendlistowner">The agent that who's friends list is being added to</param>
/// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{
m_userService.AddNewUserFriend(friendlistowner, friend, perms);
}
/// <summary> /// <summary>
/// Logs off a user and does the appropriate communications /// Logs off a user and does the appropriate communications
@ -145,42 +126,6 @@ namespace OpenSim.Framework.Communications
m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
} }
/// <summary>
/// Delete friend on friendlistowner's friendlist.
/// </summary>
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
/// <param name="friend">The Ex-friend agent</param>
public void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
m_userService.RemoveUserFriend(friendlistowner, friend);
}
/// <summary>
/// Update permissions for friend on friendlistowner's friendlist.
/// </summary>
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
/// <param name="friend">The agent that is getting or loosing permissions</param>
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
m_userService.UpdateUserFriendPerms(friendlistowner, friend, perms);
}
/// <summary>
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner
/// </summary>
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
public List<FriendListItem> GetUserFriendList(UUID friendlistowner)
{
return m_userService.GetUserFriendList(friendlistowner);
}
public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
{
return m_messageService.GetFriendRegionInfos(uuids);
}
#endregion
#region Packet Handlers #region Packet Handlers

View File

@ -1,461 +0,0 @@
/*
* 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;
using System.Collections.Generic;
using System.Net;
using System.Text.RegularExpressions;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using Nwc.XmlRpc;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Services;
using OpenSim.Region.Communications.Local;
using OpenSim.Tests.Common.Setup;
using OpenSim.Tests.Common.Mock;
using OpenSim.Client.Linden;
using OpenSim.Tests.Common;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
namespace OpenSim.Framework.Communications.Tests
{
/// <summary>
/// Test the login service. For now, most of this will be done through the LocalLoginService as LoginService
/// is abstract
/// </summary>
[TestFixture]
public class LoginServiceTests
{
private string m_firstName = "Adam";
private string m_lastName = "West";
private string m_regionExternalName = "localhost";
private IPEndPoint m_capsEndPoint;
private TestCommunicationsManager m_commsManager;
private TestLoginToRegionConnector m_regionConnector;
private LocalUserServices m_localUserServices;
private LoginService m_loginService;
private UserProfileData m_userProfileData;
private TestScene m_testScene;
[SetUp]
public void SetUpLoginEnviroment()
{
m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123);
m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43));
m_regionConnector = new TestLoginToRegionConnector();
m_testScene = SceneSetupHelpers.SetupScene(m_commsManager, "");
m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName));
//IInventoryService m_inventoryService = new MockInventoryService();
m_localUserServices = (LocalUserServices) m_commsManager.UserService;
m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43);
m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_testScene.InventoryService,
m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector);
m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName);
}
/// <summary>
/// Test the normal response to a login. Does not test authentication.
/// </summary>
[Test]
public void T010_TestUnauthenticatedLogin()
{
TestHelper.InMethod();
// We want to use our own LoginService for this test, one that
// doesn't require authentication.
new LLStandaloneLoginService(
(UserManagerBase)m_commsManager.UserService, "Hello folks", new MockInventoryService(),
m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector);
Hashtable loginParams = new Hashtable();
loginParams["first"] = m_firstName;
loginParams["last"] = m_lastName;
loginParams["passwd"] = "boingboing";
ArrayList sendParams = new ArrayList();
sendParams.Add(loginParams);
sendParams.Add(m_capsEndPoint); // is this parameter correct?
sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
IPAddress tmpLocal = Util.GetLocalHost();
IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
Hashtable responseData = (Hashtable)response.Value;
Assert.That(responseData["first_name"], Is.EqualTo(m_firstName));
Assert.That(responseData["last_name"], Is.EqualTo(m_lastName));
Assert.That(
responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(Int32.MaxValue));
Regex capsSeedPattern
= new Regex("^http://"
+ NetworkUtil.GetHostFor(tmpLocal, m_regionExternalName)
+ ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}0000/$");
Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True);
}
[Test]
public void T011_TestAuthenticatedLoginSuccess()
{
TestHelper.InMethod();
// TODO: Not check inventory part of response yet.
// TODO: Not checking all of login response thoroughly yet.
// 1) Test for positive authentication
Hashtable loginParams = new Hashtable();
loginParams["first"] = m_firstName;
loginParams["last"] = m_lastName;
loginParams["passwd"] = "boingboing";
ArrayList sendParams = new ArrayList();
sendParams.Add(loginParams);
sendParams.Add(m_capsEndPoint); // is this parameter correct?
sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
IPAddress tmpLocal = Util.GetLocalHost();
IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
Hashtable responseData = (Hashtable)response.Value;
UserAgentData uagent = m_userProfileData.CurrentAgent;
Assert.That(uagent,Is.Not.Null);
Assert.That(responseData["first_name"], Is.Not.Null);
Assert.That(responseData["first_name"], Is.EqualTo(m_firstName));
Assert.That(responseData["last_name"], Is.EqualTo(m_lastName));
Assert.That(responseData["agent_id"], Is.EqualTo(uagent.ProfileID.ToString()));
Assert.That(responseData["session_id"], Is.EqualTo(uagent.SessionID.ToString()));
Assert.That(responseData["secure_session_id"], Is.EqualTo(uagent.SecureSessionID.ToString()));
ArrayList invlibroot = (ArrayList) responseData["inventory-lib-root"];
Hashtable invlibroothash = (Hashtable) invlibroot[0];
Assert.That(invlibroothash["folder_id"],Is.EqualTo("00000112-000f-0000-0000-000100bba000"));
Assert.That(
responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(Int32.MaxValue));
Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
Assert.That(responseData["buddy-list"], Is.Empty);
Assert.That(responseData["start_location"], Is.EqualTo("last"));
Regex capsSeedPattern
= new Regex("^http://"
+ NetworkUtil.GetHostFor(tmpLocal, m_regionExternalName)
+ ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}0000/$");
Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True);
}
[Test]
public void T012_TestAuthenticatedLoginForBuddies()
{
TestHelper.InMethod();
// 1.1) Test for budddies!
m_localUserServices.AddUser("Friend","Number1","boingboing","abc@ftw.com",42,43);
m_localUserServices.AddUser("Friend","Number2","boingboing","abc@ftw.com",42,43);
UserProfileData friend1 = m_localUserServices.GetUserProfile("Friend","Number1");
UserProfileData friend2 = m_localUserServices.GetUserProfile("Friend","Number2");
m_localUserServices.AddNewUserFriend(friend1.ID,m_userProfileData.ID,1);
m_localUserServices.AddNewUserFriend(friend1.ID,friend2.ID,2);
Hashtable loginParams = new Hashtable();
loginParams["first"] = "Friend";
loginParams["last"] = "Number1";
loginParams["passwd"] = "boingboing";
ArrayList sendParams = new ArrayList();
sendParams.Add(loginParams);
sendParams.Add(m_capsEndPoint); // is this parameter correct?
sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
IPAddress tmpLocal = Util.GetLocalHost();
IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
Hashtable responseData = (Hashtable)response.Value;
ArrayList friendslist = (ArrayList) responseData["buddy-list"];
Assert.That(friendslist,Is.Not.Null);
Hashtable buddy1 = (Hashtable) friendslist[0];
Hashtable buddy2 = (Hashtable) friendslist[1];
Assert.That(friendslist.Count, Is.EqualTo(2));
Assert.That(m_userProfileData.ID.ToString(), Is.EqualTo(buddy1["buddy_id"]) | Is.EqualTo(buddy2["buddy_id"]));
Assert.That(friend2.ID.ToString(), Is.EqualTo(buddy1["buddy_id"]) | Is.EqualTo(buddy2["buddy_id"]));
}
[Test]
public void T020_TestAuthenticatedLoginBadUsername()
{
TestHelper.InMethod();
// 2) Test for negative authentication
//
string error_auth_message = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.";
//string error_region_unavailable = "The region you are attempting to log into is not responding. Please select another region and try again.";
// 2.1) Test for wrong user name
Hashtable loginParams = new Hashtable();
loginParams["first"] = m_lastName;
loginParams["last"] = m_firstName;
loginParams["passwd"] = "boingboing";
ArrayList sendParams = new ArrayList();
sendParams.Add(loginParams);
sendParams.Add(m_capsEndPoint); // is this parameter correct?
sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
IPAddress tmpLocal = Util.GetLocalHost();
IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
Hashtable responseData = (Hashtable)response.Value;
Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
}
[Test]
public void T021_TestAuthenticatedLoginBadPassword()
{
TestHelper.InMethod();
string error_auth_message = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.";
// 2.2) Test for wrong password
Hashtable loginParams = new Hashtable();
loginParams["first"] = "Friend";
loginParams["last"] = "Number2";
loginParams["passwd"] = "boing";
ArrayList sendParams = new ArrayList();
sendParams.Add(loginParams);
sendParams.Add(m_capsEndPoint); // is this parameter correct?
sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
IPAddress tmpLocal = Util.GetLocalHost();
IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
Hashtable responseData = (Hashtable)response.Value;
Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
}
[Test]
public void T022_TestAuthenticatedLoginBadXml()
{
TestHelper.InMethod();
string error_xml_message = "Error connecting to grid. Could not percieve credentials from login XML.";
// 2.3) Bad XML
Hashtable loginParams = new Hashtable();
loginParams["first"] = "Friend";
loginParams["banana"] = "Banana";
loginParams["passwd"] = "boingboing";
ArrayList sendParams = new ArrayList();
sendParams.Add(loginParams);
sendParams.Add(m_capsEndPoint); // is this parameter correct?
sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
IPAddress tmpLocal = Util.GetLocalHost();
IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
Hashtable responseData = (Hashtable)response.Value;
Assert.That(responseData["message"], Is.EqualTo(error_xml_message));
}
// [Test]
// Commenting out test now that LLStandAloneLoginService no longer replies with message in this case.
// Kept the code for future test with grid mode, which will keep this behavior.
public void T023_TestAuthenticatedLoginAlreadyLoggedIn()
{
TestHelper.InMethod();
//Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()");
//log4net.Config.XmlConfigurator.Configure();
string error_already_logged = "You appear to be already logged in. " +
"If this is not the case please wait for your session to timeout. " +
"If this takes longer than a few minutes please contact the grid owner. " +
"Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.";
// 2.4) Already logged in and sucessfull post login
Hashtable loginParams = new Hashtable();
loginParams["first"] = "Adam";
loginParams["last"] = "West";
loginParams["passwd"] = "boingboing";
ArrayList sendParams = new ArrayList();
sendParams.Add(loginParams);
sendParams.Add(m_capsEndPoint); // is this parameter correct?
sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
// First we log in.
XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
IPAddress tmpLocal = Util.GetLocalHost();
IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
Hashtable responseData = (Hashtable)response.Value;
Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
// Then we try again, this time expecting failure.
request = new XmlRpcRequest("login_to_simulator", sendParams);
response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
responseData = (Hashtable)response.Value;
Assert.That(responseData["message"], Is.EqualTo(error_already_logged));
// Finally the third time we should be able to get right back in.
request = new XmlRpcRequest("login_to_simulator", sendParams);
response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
responseData = (Hashtable)response.Value;
Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
//Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()");
}
[TearDown]
public void TearDown()
{
try
{
if (MainServer.Instance != null) MainServer.Instance.Stop();
} catch (NullReferenceException)
{}
}
public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector
{
private List<RegionInfo> m_regionsList = new List<RegionInfo>();
public void AddRegion(RegionInfo regionInfo)
{
lock (m_regionsList)
{
if (!m_regionsList.Contains(regionInfo))
{
m_regionsList.Add(regionInfo);
}
}
}
#region ILoginRegionsConnector Members
public bool RegionLoginsEnabled
{
get { return true; }
}
public void LogOffUserFromGrid(ulong regionHandle, OpenMetaverse.UUID AvatarID, OpenMetaverse.UUID RegionSecret, string message)
{
}
public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason)
{
reason = String.Empty;
lock (m_regionsList)
{
foreach (RegionInfo regInfo in m_regionsList)
{
if (regInfo.RegionHandle == regionHandle)
return true;
}
}
reason = "Region not found";
return false;
}
public RegionInfo RequestClosestRegion(string region)
{
lock (m_regionsList)
{
foreach (RegionInfo regInfo in m_regionsList)
{
if (regInfo.RegionName == region)
return regInfo;
}
}
return null;
}
public RegionInfo RequestNeighbourInfo(OpenMetaverse.UUID regionID)
{
lock (m_regionsList)
{
foreach (RegionInfo regInfo in m_regionsList)
{
if (regInfo.RegionID == regionID)
return regInfo;
}
}
return null;
}
public RegionInfo RequestNeighbourInfo(ulong regionHandle)
{
lock (m_regionsList)
{
foreach (RegionInfo regInfo in m_regionsList)
{
if (regInfo.RegionHandle == regionHandle)
return regInfo;
}
}
return null;
}
#endregion
}
}
}

View File

@ -53,7 +53,6 @@ namespace OpenSim.Region.Communications.Hypergrid
userServices.AddPlugin(new HGUserDataPlugin(this, userServices)); userServices.AddPlugin(new HGUserDataPlugin(this, userServices));
m_userService = userServices; m_userService = userServices;
m_messageService = userServices;
m_avatarService = userServices; m_avatarService = userServices;
} }
} }

View File

@ -61,8 +61,6 @@ namespace OpenSim.Region.Communications.Hypergrid
m_userService = hgUserService; m_userService = hgUserService;
m_userAdminService = hgUserService; m_userAdminService = hgUserService;
m_avatarService = hgUserService; m_avatarService = hgUserService;
m_messageService = hgUserService;
} }
} }
} }

View File

@ -51,7 +51,6 @@ namespace OpenSim.Region.Communications.Local
m_userService = lus; m_userService = lus;
m_userAdminService = lus; m_userAdminService = lus;
m_avatarService = lus; m_avatarService = lus;
m_messageService = lus;
//LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService); //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
} }

View File

@ -46,7 +46,6 @@ namespace OpenSim.Region.Communications.OGS1
userServices.AddPlugin(new OGS1UserDataPlugin(this)); userServices.AddPlugin(new OGS1UserDataPlugin(this));
m_userService = userServices; m_userService = userServices;
m_messageService = userServices;
m_avatarService = (IAvatarService)m_userService; m_avatarService = (IAvatarService)m_userService;
} }

View File

@ -3979,35 +3979,6 @@ namespace OpenSim.Region.Framework.Scenes
objectCapacity = objects; objectCapacity = objects;
} }
public List<FriendListItem> GetFriendList(string id)
{
UUID avatarID;
if (!UUID.TryParse(id, out avatarID))
return new List<FriendListItem>();
return CommsManager.GetUserFriendList(avatarID);
}
public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
{
return CommsManager.GetFriendRegionInfos(uuids);
}
public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms)
{
m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms);
}
public virtual void StoreUpdateFriendship(UUID ownerID, UUID friendID, uint perms)
{
m_sceneGridService.UpdateUserFriendPerms(ownerID, friendID, perms);
}
public virtual void StoreRemoveFriendship(UUID ownerID, UUID ExfriendID)
{
m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID);
}
#endregion #endregion
public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)

View File

@ -1455,25 +1455,6 @@ namespace OpenSim.Region.Framework.Scenes
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
} }
public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{
m_commsProvider.AddNewUserFriend(friendlistowner, friend, perms);
}
public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
m_commsProvider.UpdateUserFriendPerms(friendlistowner, friend, perms);
}
public void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
m_commsProvider.RemoveUserFriend(friendlistowner, friend);
}
public List<FriendListItem> GetUserFriendList(UUID friendlistowner)
{
return m_commsProvider.GetUserFriendList(friendlistowner);
}
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
{ {