From ce4bcb50655e69277eac64a6d3ab520d669e6b70 Mon Sep 17 00:00:00 2001 From: Johan Berntsson Date: Wed, 23 Jul 2008 09:46:04 +0000 Subject: The new secure inventory server mode (in r5590) can now be disabled from OpenSim.ini. Default is to use the new mode. --- .../Communications/Cache/CachedUserInfo.cs | 64 +++++++++++++++++++--- .../Cache/UserProfileCacheService.cs | 9 ++- .../Communications/CommunicationsManager.cs | 52 +++++++++++++++++- 3 files changed, 114 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index c125976..383c129 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -335,8 +335,14 @@ namespace OpenSim.Framework.Communications.Cache createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Version = createdFolder.Version; - m_commsManager.SecureInventoryService.AddFolder(createdBaseFolder, m_session_id); - + if (m_commsManager.SecureInventoryService != null) + { + m_commsManager.SecureInventoryService.AddFolder(createdBaseFolder, m_session_id); + } + else + { + m_commsManager.InventoryService.AddFolder(createdBaseFolder); + } return true; } else @@ -389,7 +395,14 @@ namespace OpenSim.Framework.Communications.Cache baseFolder.Type = (short)type; baseFolder.Version = RootFolder.Version; - m_commsManager.SecureInventoryService.UpdateFolder(baseFolder, m_session_id); + if (m_commsManager.SecureInventoryService != null) + { + m_commsManager.SecureInventoryService.UpdateFolder(baseFolder, m_session_id); + } + else + { + m_commsManager.InventoryService.UpdateFolder(baseFolder); + } InventoryFolderImpl folder = RootFolder.FindFolder(folderID); if (folder != null) @@ -431,7 +444,14 @@ namespace OpenSim.Framework.Communications.Cache baseFolder.ID = folderID; baseFolder.ParentID = parentID; - m_commsManager.SecureInventoryService.MoveFolder(baseFolder, m_session_id); + if (m_commsManager.SecureInventoryService != null) + { + m_commsManager.SecureInventoryService.MoveFolder(baseFolder, m_session_id); + } + else + { + m_commsManager.InventoryService.MoveFolder(baseFolder); + } InventoryFolderImpl folder = RootFolder.FindFolder(folderID); if (folder != null) @@ -478,7 +498,14 @@ namespace OpenSim.Framework.Communications.Cache purgedBaseFolder.Type = purgedFolder.Type; purgedBaseFolder.Version = purgedFolder.Version; - m_commsManager.SecureInventoryService.PurgeFolder(purgedBaseFolder, m_session_id); + if (m_commsManager.SecureInventoryService != null) + { + m_commsManager.SecureInventoryService.PurgeFolder(purgedBaseFolder, m_session_id); + } + else + { + m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder); + } purgedFolder.Purge(); @@ -515,7 +542,14 @@ namespace OpenSim.Framework.Communications.Cache item.Folder = RootFolder.ID; } ItemReceive(item); - m_commsManager.SecureInventoryService.AddItem(item, m_session_id); + if (m_commsManager.SecureInventoryService != null) + { + m_commsManager.SecureInventoryService.AddItem(item, m_session_id); + } + else + { + m_commsManager.InventoryService.AddItem(item); + } } else { @@ -535,7 +569,14 @@ namespace OpenSim.Framework.Communications.Cache { if (HasInventory) { - m_commsManager.SecureInventoryService.UpdateItem(item, m_session_id); + if (m_commsManager.SecureInventoryService != null) + { + m_commsManager.SecureInventoryService.UpdateItem(item, m_session_id); + } + else + { + m_commsManager.InventoryService.UpdateItem(item); + } } else { @@ -574,7 +615,14 @@ namespace OpenSim.Framework.Communications.Cache if (RootFolder.DeleteItem(item.ID)) { - return m_commsManager.SecureInventoryService.DeleteItem(item, m_session_id); + if (m_commsManager.SecureInventoryService != null) + { + return m_commsManager.SecureInventoryService.DeleteItem(item, m_session_id); + } + else + { + return m_commsManager.InventoryService.DeleteItem(item); + } } } else diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index e22dff6..d6421b0 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -146,7 +146,14 @@ namespace OpenSim.Framework.Communications.Cache CachedUserInfo userInfo = GetUserDetails(userID); if (userInfo != null) { - m_commsManager.SecureInventoryService.RequestInventoryForUser(userID, userInfo.SessionID, userInfo.InventoryReceive); + if (m_commsManager.SecureInventoryService != null) + { + m_commsManager.SecureInventoryService.RequestInventoryForUser(userID, userInfo.SessionID, userInfo.InventoryReceive); + } + else + { + m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive); + } //IInventoryServices invService = userInfo.GetInventoryService(); //if (invService != null) //{ diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 8caeeb3..80dfa2c 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -112,11 +112,23 @@ namespace OpenSim.Framework.Communications protected List m_inventoryServices = new List(); // protected IInventoryServices m_inventoryService; - protected ISecureInventoryService m_secureinventoryServices; + protected List m_secureinventoryServices = new List(); public ISecureInventoryService SecureInventoryService { - get { return m_secureinventoryServices; } + get + { + if (m_secureinventoryServices.Count > 0) + { + // return m_inventoryServices[0]; + ISecureInventoryService invService; + if (TryGetSecureInventoryService(m_defaultInventoryHost, out invService)) + { + return invService; + } + } + return null; + } } public IInventoryServices InventoryService @@ -136,6 +148,29 @@ namespace OpenSim.Framework.Communications } } + public bool TryGetSecureInventoryService(string host, out ISecureInventoryService inventoryService) + { + if ((host == string.Empty) || (host == "default")) + { + host = m_defaultInventoryHost; + } + + lock (m_secureinventoryServices) + { + foreach (ISecureInventoryService service in m_secureinventoryServices) + { + if (service.Host == host) + { + inventoryService = service; + return true; + } + } + } + + inventoryService = null; + return false; + } + public bool TryGetInventoryService(string host, out IInventoryServices inventoryService) { if ((host == string.Empty) || (host == "default")) @@ -164,6 +199,19 @@ namespace OpenSim.Framework.Communications } + public virtual void AddSecureInventoryService(string hostUrl) + { + + } + + public virtual void AddSecureInventoryService(ISecureInventoryService service) + { + lock (m_secureinventoryServices) + { + m_secureinventoryServices.Add(service); + } + } + public virtual void AddInventoryService(IInventoryServices service) { lock (m_inventoryServices) -- cgit v1.1