* Only allow logins on standalone when the sim has completed it's initial startup (script startup doesn't count here)

* There was a small window where region logins were allowed before modules were loaded - avatars logins that hit this window could have caused bad things to happen.
* A similar change will follow for grid mode sometime soon
0.6.0-stable
Justin Clarke Casey 2008-09-19 17:41:21 +00:00
parent 5d3fe9f8cd
commit 5fb7b485b2
13 changed files with 121 additions and 71 deletions

View File

@ -51,12 +51,20 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary>
private readonly Dictionary<UUID, CachedUserInfo> m_userProfiles = new Dictionary<UUID, CachedUserInfo>();
public readonly LibraryRootFolder libraryRoot = new LibraryRootFolder();
/// <summary>
/// The root library folder.
/// </summary>
public readonly LibraryRootFolder LibraryRoot;
// Methods
public UserProfileCacheService(CommunicationsManager commsManager)
/// <summary>
/// Constructor
/// </summary>
/// <param name="commsManager"></param>
/// <param name="libraryRootFolder"></param>
public UserProfileCacheService(CommunicationsManager commsManager, LibraryRootFolder libraryRootFolder)
{
m_commsManager = commsManager;
LibraryRoot = libraryRootFolder;
}
/// <summary>
@ -293,10 +301,10 @@ namespace OpenSim.Framework.Communications.Cache
// FIXME MAYBE: We're not handling sortOrder!
InventoryFolderImpl fold = null;
if ((fold = libraryRoot.FindFolder(folderID)) != null)
if ((fold = LibraryRoot.FindFolder(folderID)) != null)
{
remoteClient.SendInventoryFolderDetails(
libraryRoot.Owner, folderID, fold.RequestListOfItems(),
LibraryRoot.Owner, folderID, fold.RequestListOfItems(),
fold.RequestListOfFolders(), fetchFolders, fetchItems);
return;
@ -337,7 +345,7 @@ namespace OpenSim.Framework.Communications.Cache
// FIXME MAYBE: We're not handling sortOrder!
InventoryFolderImpl fold;
if ((fold = libraryRoot.FindFolder(folderID)) != null)
if ((fold = LibraryRoot.FindFolder(folderID)) != null)
{
return fold.RequestListOfItems();
}
@ -428,7 +436,7 @@ namespace OpenSim.Framework.Communications.Cache
public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)
{
if (ownerID == libraryRoot.Owner)
if (ownerID == LibraryRoot.Owner)
{
//Console.WriteLine("request info for library item");

View File

@ -112,11 +112,11 @@ namespace OpenSim.Framework.Communications
/// <param name="assetCache"></param>
/// <param name="dumpAssetsToFile"></param>
public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache,
bool dumpAssetsToFile)
bool dumpAssetsToFile, LibraryRootFolder libraryRootFolder)
{
m_networkServersInfo = serversInfo;
m_assetCache = assetCache;
m_userProfileCacheService = new UserProfileCacheService(this);
m_userProfileCacheService = new UserProfileCacheService(this, libraryRootFolder);
// m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile);
}
@ -356,7 +356,7 @@ namespace OpenSim.Framework.Communications
public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
{
if (uuid == m_userProfileCacheService.libraryRoot.Owner)
if (uuid == m_userProfileCacheService.LibraryRoot.Owner)
{
remote_client.SendNameReply(uuid, "Mr", "OpenSim");
}
@ -376,7 +376,6 @@ namespace OpenSim.Framework.Communications
string[] returnstring = new string[0];
bool doLookup = false;
lock (m_nameRequestCache)
{
if (m_nameRequestCache.ContainsKey(uuid))
@ -405,8 +404,8 @@ namespace OpenSim.Framework.Communications
}
}
}
return returnstring;
return returnstring;
}
public bool UUIDNameCachedTest(UUID uuid)

View File

@ -34,6 +34,11 @@ namespace OpenSim.Framework.Communications
{
string gdebugRegionName { get; set; }
/// <summary>
/// If true, then regions will accept logins from the user service. If false, then they will not.
/// </summary>
bool RegionLoginsEnabled { get; set; }
/// <summary>
/// Register a region with the grid service.
/// </summary>

View File

@ -239,8 +239,8 @@ namespace OpenSim.Framework.Communications
catch (Exception e)
{
m_log.ErrorFormat(
"[LOGIN END]: XMLRPC Error retrieving inventory skeleton of agent {0}, {1} - {2}",
agentID, e.GetType(), e.Message);
"[LOGIN END]: Error retrieving inventory skeleton of agent {0} - {1}",
agentID, e);
return logResponse.CreateLoginInventoryFailedResponse();
}

View File

@ -84,7 +84,6 @@ namespace OpenSim
public bool m_gridLocalAsset;
public bool m_see_into_region_from_neighbor;
protected LocalLoginService m_loginService;
protected GridInfoService m_gridInfoService;
protected string m_storageDll;
@ -369,6 +368,8 @@ namespace OpenSim
m_stats = StatsManager.StartCollectingSimExtraStats();
LibraryRootFolder libraryRootFolder = new LibraryRootFolder();
// StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false)
if (m_sandbox)
{
@ -382,24 +383,24 @@ namespace OpenSim
LocalBackEndServices backendService = new LocalBackEndServices();
CommunicationsLocal localComms =
new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, userService,
inventoryService, backendService, backendService, m_dumpAssetsToFile);
m_commsManager = localComms;
LocalLoginService loginService =
new LocalLoginService(
userService, m_standaloneWelcomeMessage, inventoryService, backendService, m_networkServersInfo,
m_standaloneAuthenticate, libraryRootFolder);
m_loginService =
new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo,
m_standaloneAuthenticate);
m_loginService.OnLoginToRegion += backendService.AddNewSession;
m_commsManager
= new CommunicationsLocal(
m_networkServersInfo, m_httpServer, m_assetCache, userService, userService,
inventoryService, backendService, backendService, libraryRootFolder, m_dumpAssetsToFile);
// set up XMLRPC handler for client's initial login request message
m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
// provides the web form login
m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin);
// Provides the LLSD login
m_httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod);
// provide grid info
// m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini")));
@ -410,7 +411,9 @@ namespace OpenSim
else
{
// We are in grid mode
m_commsManager = new CommunicationsOGS1(m_networkServersInfo, m_httpServer, m_assetCache);
m_commsManager
= new CommunicationsOGS1(m_networkServersInfo, m_httpServer, m_assetCache, libraryRootFolder);
m_httpServer.AddStreamHandler(new SimStatusHandler());
}
@ -421,6 +424,9 @@ namespace OpenSim
m_moduleLoader = new ModuleLoader(m_config.Source);
LoadPlugins();
// Only enable logins to the regions once we have completely finished starting up
m_commsManager.GridService.RegionLoginsEnabled = true;
}
protected override void Initialize()

View File

@ -4884,7 +4884,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
if (assetRequestItem == null)
{
assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.libraryRoot.FindItem(itemID);
assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
if (assetRequestItem == null)
return;
}

View File

@ -87,9 +87,7 @@ namespace OpenSim.Region.ClientStack
m_log.Error("[HTTP]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
}
m_log.Info("[REGION]: Starting HTTP server");
m_httpServer.Start();
}

View File

@ -42,8 +42,8 @@ namespace OpenSim.Region.Communications.Local
IUserServiceAdmin userServiceAdmin,
LocalInventoryService inventoryService,
IInterRegionCommunications interRegionService,
IGridServices gridService, bool dumpAssetsToFile)
: base(serversInfo, httpServer, assetCache, dumpAssetsToFile)
IGridServices gridService, LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile)
: base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder)
{
AddInventoryService(inventoryService);
m_defaultInventoryHost = inventoryService.Host;

View File

@ -51,6 +51,13 @@ namespace OpenSim.Region.Communications.Local
public string _gdebugRegionName = String.Empty;
public bool RegionLoginsEnabled
{
get { return m_regionLoginsEnabled; }
set { m_regionLoginsEnabled = value; }
}
private bool m_regionLoginsEnabled;
public bool CheckRegion(string address, uint port)
{
return true;
@ -70,10 +77,6 @@ namespace OpenSim.Region.Communications.Local
set { _rdebugRegionName = value; }
}
public LocalBackEndServices()
{
}
/// <summary>
/// Register a region method with the BackEnd Services.
/// </summary>

View File

@ -34,6 +34,7 @@ using OpenMetaverse;
using log4net;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
namespace OpenSim.Region.Communications.Local
{
@ -43,27 +44,41 @@ namespace OpenSim.Region.Communications.Local
{
protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected CommunicationsLocal m_Parent;
protected NetworkServersInfo serversInfo;
protected uint defaultHomeX;
protected uint defaultHomeY;
protected bool authUsers = false;
/// <summary>
/// Used by the login service to make requests to the inventory service.
/// </summary>
protected IInterServiceInventoryServices m_interServiceInventoryService;
/// <summary>
/// Used to make requests to the local regions.
/// </summary>
protected IGridServices m_gridService;
public event LoginToRegionEvent OnLoginToRegion;
protected LoginToRegionEvent handlerLoginToRegion = null; // OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess,
CommunicationsLocal parent, NetworkServersInfo serversInfo,
bool authenticate)
: base(userManager, parent.UserProfileCacheService.libraryRoot, welcomeMess)
public LocalLoginService(
UserManagerBase userManager, string welcomeMess,
IInterServiceInventoryServices interServiceInventoryService, LocalBackEndServices gridService,
NetworkServersInfo serversInfo,
bool authenticate, LibraryRootFolder libraryRootFolder)
: base(userManager, libraryRootFolder, welcomeMess)
{
m_Parent = parent;
this.serversInfo = serversInfo;
defaultHomeX = this.serversInfo.DefaultHomeLocX;
defaultHomeY = this.serversInfo.DefaultHomeLocY;
authUsers = authenticate;
m_interServiceInventoryService = interServiceInventoryService;
m_gridService = gridService;
OnLoginToRegion += gridService.AddNewSession;
}
public override UserProfileData GetTheUser(string firstname, string lastname)
@ -84,7 +99,7 @@ namespace OpenSim.Region.Communications.Local
profile = m_userManager.GetUserProfile(firstname, lastname);
if (profile != null)
{
m_Parent.InterServiceInventoryService.CreateNewUserInventory(profile.ID);
m_interServiceInventoryService.CreateNewUserInventory(profile.ID);
}
return profile;
@ -129,11 +144,12 @@ namespace OpenSim.Region.Communications.Local
{
// HomeLocation
RegionInfo homeInfo = null;
// use the homeRegionID if it is stored already. If not, use the regionHandle as before
if (theUser.HomeRegionID != UUID.Zero)
homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegionID);
homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegionID);
else
homeInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegion);
homeInfo = m_gridService.RequestNeighbourInfo(theUser.HomeRegion);
if (homeInfo != null)
{
response.Home =
@ -172,7 +188,7 @@ namespace OpenSim.Region.Communications.Local
}
else if (startLocationRequest == "last")
{
regionInfo = m_Parent.GridService.RequestNeighbourInfo(theUser.CurrentAgent.Region);
regionInfo = m_gridService.RequestNeighbourInfo(theUser.CurrentAgent.Region);
response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]";
}
else
@ -186,7 +202,7 @@ namespace OpenSim.Region.Communications.Local
else
{
string region = uriMatch.Groups["region"].ToString();
regionInfo = m_Parent.GridService.RequestClosestRegion(region);
regionInfo = m_gridService.RequestClosestRegion(region);
if (regionInfo == null)
{
m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region);
@ -208,7 +224,7 @@ namespace OpenSim.Region.Communications.Local
}
// StartLocation not available, send him to a nearby region instead
// regionInfo = m_Parent.GridService.RequestClosestRegion("");
// regionInfo = m_gridService.RequestClosestRegion("");
//m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName);
// Send him to default region instead
@ -222,7 +238,7 @@ namespace OpenSim.Region.Communications.Local
}
m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead");
regionInfo = m_Parent.GridService.RequestNeighbourInfo(defaultHandle);
regionInfo = m_gridService.RequestNeighbourInfo(defaultHandle);
// Customise the response
//response.Home =
@ -274,24 +290,26 @@ namespace OpenSim.Region.Communications.Local
loginParams.StartPos = user.CurrentAgent.Position;
loginParams.CapsPath = capsPath;
if (m_gridService.RegionLoginsEnabled)
{
handlerLoginToRegion = OnLoginToRegion;
if (handlerLoginToRegion == null)
return false;
handlerLoginToRegion(user.CurrentAgent.Handle, loginParams);
return true;
}
return false;
}
// See LoginService
protected override InventoryData GetInventorySkeleton(UUID userID)
{
List<InventoryFolderBase> folders = m_Parent.InterServiceInventoryService.GetInventorySkeleton(userID);
List<InventoryFolderBase> folders = m_interServiceInventoryService.GetInventorySkeleton(userID);
// If we have user auth but no inventory folders for some reason, create a new set of folders.
if (null == folders || 0 == folders.Count)
{
m_Parent.InterServiceInventoryService.CreateNewUserInventory(userID);
folders = m_Parent.InterServiceInventoryService.GetInventorySkeleton(userID);
m_interServiceInventoryService.CreateNewUserInventory(userID);
folders = m_interServiceInventoryService.GetInventorySkeleton(userID);
}
UUID rootID = UUID.Zero;

View File

@ -34,8 +34,10 @@ namespace OpenSim.Region.Communications.OGS1
{
public class CommunicationsOGS1 : CommunicationsManager
{
public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache)
: base(serversInfo, httpServer, assetCache, false)
public CommunicationsOGS1(
NetworkServersInfo serversInfo, BaseHttpServer httpServer,
AssetCache assetCache, LibraryRootFolder libraryRootFolder)
: base(serversInfo, httpServer, assetCache, false, libraryRootFolder)
{
OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
m_gridService = gridInterComms;

View File

@ -51,15 +51,16 @@ namespace OpenSim.Region.Communications.OGS1
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// FIXME: LocalBackEndServices should to be refactored into a separate common parent class rather than
// encapsulated.
private LocalBackEndServices m_localBackend = new LocalBackEndServices();
private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
// private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>();
private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>();
private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
private List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>();
public BaseHttpServer httpListener;
public NetworkServersInfo serversInfo;
public BaseHttpServer httpServer;
@ -80,6 +81,16 @@ namespace OpenSim.Region.Communications.OGS1
set { _rdebugRegionName = value; }
}
/// <summary>
/// Doesn't have any effect yet!
/// </summary>
public bool RegionLoginsEnabled
{
get { return m_regionLoginsEnabled; }
set { m_regionLoginsEnabled = value; }
}
private bool m_regionLoginsEnabled;
/// <summary>
/// Contructor. Adds "expect_user" and "check" xmlrpc method handlers
/// </summary>

View File

@ -500,7 +500,7 @@ namespace OpenSim.Region.Environment.Scenes
"[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}",
remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName);
InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(oldItemID);
InventoryItemBase item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(oldItemID);
if (item == null)
{
@ -1207,7 +1207,7 @@ namespace OpenSim.Region.Environment.Scenes
// XXX clumsy, possibly should be one call
if (null == item)
{
item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(itemID);
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
}
if (item != null)
@ -1272,7 +1272,7 @@ namespace OpenSim.Region.Environment.Scenes
// XXX clumsy, possibly should be one call
if (null == item)
{
item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(itemID);
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
}
if (item != null)