* Rex merge, local communications -- LocalLoginService line 186 needs tweaking.

afrisby-3
Adam Frisby 2008-02-23 03:34:31 +00:00
parent 5745db2a35
commit fe50f2e6b9
5 changed files with 1054 additions and 945 deletions

View File

@ -36,6 +36,8 @@ namespace OpenSim.Region.Communications.Local
{
public class LocalBackEndServices : IGridServices, IInterRegionCommunications
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
protected Dictionary<ulong, RegionCommsListener> m_regionListeners =
@ -45,7 +47,19 @@ namespace OpenSim.Region.Communications.Local
private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
public string _gdebugRegionName = "";
public string _gdebugRegionName = System.String.Empty;
bool m_bAvailable=true;
public void CheckRegion(string address, uint port)
{
m_bAvailable = true;
}
public bool Available
{
get { return m_bAvailable; }
}
public string gdebugRegionName
{
@ -53,7 +67,7 @@ namespace OpenSim.Region.Communications.Local
set { _gdebugRegionName = value; }
}
public string _rdebugRegionName = "";
public string _rdebugRegionName = System.String.Empty;
public string rdebugRegionName
{
@ -81,8 +95,9 @@ namespace OpenSim.Region.Communications.Local
RegionCommsListener regionHost = new RegionCommsListener();
if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
{
MainLog.Instance.Error("INTERREGION",
"Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up.");
m_log.Error("[INTERREGION]: " +
"Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. " +
"In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up.");
m_regionListeners.Remove(regionInfo.RegionHandle);
}
m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
@ -93,7 +108,7 @@ namespace OpenSim.Region.Communications.Local
{
// Already in our list, so the region went dead and restarted.
m_regions.Remove(regionInfo.RegionHandle);
MainLog.Instance.Warn("INTERREGION", "Region registered twice. Region went down and came back up.");
m_log.Warn("[INTERREGION]: Region registered twice. Region went down and came back up.");
RegionCommsListener regionHost = new RegionCommsListener();
if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
@ -191,7 +206,14 @@ namespace OpenSim.Region.Communications.Local
}
return mapBlocks;
}
public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
}
return false;
}
public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
{
@ -210,7 +232,7 @@ namespace OpenSim.Region.Communications.Local
{
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData);
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
return true;
}
@ -255,6 +277,14 @@ namespace OpenSim.Region.Communications.Local
return false;
}
public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
}
return false;
}
/// <summary>
/// </summary>
/// <param name="regionHandle"></param>
@ -265,13 +295,13 @@ namespace OpenSim.Region.Communications.Local
//should change from agentCircuitData
{
//Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname);
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname);
if (m_regionListeners.ContainsKey(regionHandle))
{
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
return true;
}
@ -316,13 +346,7 @@ namespace OpenSim.Region.Communications.Local
return false;
}
public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
{
if (m_regionListeners.ContainsKey(regionHandle))
{
m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID);
}
}
public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
{
@ -373,11 +397,11 @@ namespace OpenSim.Region.Communications.Local
public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
{
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname);
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname);
if (m_regionListeners.ContainsKey(regionHandle))
{
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent);
}
@ -427,11 +451,11 @@ namespace OpenSim.Region.Communications.Local
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
// MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname);
// m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname);
if (m_regionListeners.ContainsKey(regionHandle))
{
//MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname);
//m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname);
TriggerExpectUser(regionHandle, agentData);
return true;

View File

@ -13,7 +13,7 @@
* 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
* 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
@ -34,6 +34,10 @@ using OpenSim.Framework.Communications.Cache;
namespace OpenSim.Region.Communications.Local
{
/// <summary>
/// An implementation of user inventory where the inventory is held locally (e.g. when OpenSim is
/// operating in standalone mode.
/// </summary>
public class LocalInventoryService : InventoryServiceBase
{
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
@ -83,6 +87,37 @@ namespace OpenSim.Region.Communications.Local
DeleteItem(item);
}
public override bool HasInventoryForUser(LLUUID userID)
{
InventoryFolderBase root = RequestUsersRoot(userID);
if (root == null)
{
return false;
}
else
{
return true;
}
}
public override InventoryFolderBase RequestNamedFolder(LLUUID userID, string folderName)
{
List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID);
InventoryFolderBase requestedFolder = null;
//need to make sure we send root folder first
foreach (InventoryFolderBase folder in folders)
{
if (folder.name == folderName)
{
requestedFolder = folder;
break;
}
}
return requestedFolder;
}
/// <summary>
/// Send the given inventory folder and its item contents back to the requester.
/// </summary>

View File

@ -13,7 +13,7 @@
* 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
* 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
@ -34,6 +34,7 @@ using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics;
using OpenSim.Framework.UserManagement;
using InventoryFolder=OpenSim.Framework.InventoryFolder;
@ -43,6 +44,8 @@ namespace OpenSim.Region.Communications.Local
public class LocalLoginService : LoginService
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private CommunicationsLocal m_Parent;
private NetworkServersInfo serversInfo;
@ -52,9 +55,12 @@ namespace OpenSim.Region.Communications.Local
public event LoginToRegionEvent OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent,
NetworkServersInfo serversInfo, bool authenticate, bool rexMode)
: base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess, rexMode)
private LoginToRegionEvent handler001 = null; // OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess,
CommunicationsLocal parent, NetworkServersInfo serversInfo,
bool authenticate)
: base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess)
{
m_Parent = parent;
this.serversInfo = serversInfo;
@ -75,7 +81,7 @@ namespace OpenSim.Region.Communications.Local
if (!authUsers)
{
//no current user account so make one
MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one.");
m_log.Info("[LOGIN]: No user account found so creating a new one.");
m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
@ -95,20 +101,25 @@ namespace OpenSim.Region.Communications.Local
if (!authUsers)
{
//for now we will accept any password in sandbox mode
MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)");
m_log.Info("[LOGIN]: Authorising user (no actual password check)");
return true;
}
else
{
MainLog.Instance.Notice(
"LOGIN", "Authenticating " + profile.username + " " + profile.surname);
m_log.Info(
"[LOGIN]: Authenticating " + profile.username + " " + 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);
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
bool loginresult = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|| profile.passwordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase));
return loginresult;
}
}
@ -173,13 +184,15 @@ namespace OpenSim.Region.Communications.Local
}
if (OnLoginToRegion != null)
handler001 = OnLoginToRegion;
if (handler001 != null)
{
OnLoginToRegion(currentRegion, _login);
handler001(currentRegion, _login);
}
}
else
{
MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion);
m_log.Warn("[LOGIN]: Not found region " + currentRegion);
}
}
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)

View File

@ -13,7 +13,7 @@
* 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
* 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
@ -30,6 +30,7 @@ using System;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Statistics;
using OpenSim.Framework.UserManagement;
namespace OpenSim.Region.Communications.Local
@ -42,6 +43,14 @@ namespace OpenSim.Region.Communications.Local
private IInventoryServices m_inventoryService;
/// <summary>
///
/// </summary>
/// <param name="serversInfo"></param>
/// <param name="defaultHomeLocX"></param>
/// <param name="defaultHomeLocY"></param>
/// <param name="inventoryService"></param>
/// <param name="statsCollector">Can be null if stats collection is not required.</param>
public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY,
IInventoryServices inventoryService)
{
@ -55,7 +64,7 @@ namespace OpenSim.Region.Communications.Local
public override UserProfileData SetupMasterUser(string firstName, string lastName)
{
return SetupMasterUser(firstName, lastName, "");
return SetupMasterUser(firstName, lastName, String.Empty);
}
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
@ -88,7 +97,7 @@ namespace OpenSim.Region.Communications.Local
UserProfileData data = GetUserProfile(uuid, "");
if (data == null)
{
throw new Exception("Unknown master user UUID");
throw new Exception("Unknown master user UUID. Possible reason: UserServer is not running.");
}
return data;
}

View File

@ -1,3 +1,31 @@
/*
* 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 OpenSim 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.Reflection;
using System.Runtime.InteropServices;
@ -10,7 +38,7 @@ using System.Runtime.InteropServices;
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("")]
[assembly : AssemblyProduct("OpenSim.Region.Communications.Local")]
[assembly : AssemblyCopyright("Copyright © 2007")]
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]