From 33ea86374a19e9d74d673f363b7981b84afe177c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Sep 2009 22:22:00 +0100 Subject: provide intelligble warning of why load/save iar doesn't work on grid mode, pending a fix --- .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 9f49da9..dc201e1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -324,6 +324,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) { CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); + //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName); if (null == userInfo) { m_log.ErrorFormat( @@ -333,6 +334,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); + + if (userInfo.UserProfile.PasswordHash == null || userInfo.UserProfile.PasswordHash == String.Empty) + { + m_log.ErrorFormat( + "[INVENTORY ARCHIVER]: Sorry, the grid mode service is not providing password hash details for the check. This will be fixed in an OpenSim git revision soon"); + + return null; + } + +// m_log.DebugFormat( +// "[INVENTORY ARCHIVER]: received salt {0}, hash {1}, supplied hash {2}", +// userInfo.UserProfile.PasswordSalt, userInfo.UserProfile.PasswordHash, md5PasswdHash); + if (userInfo.UserProfile.PasswordHash != md5PasswdHash) { m_log.ErrorFormat( -- cgit v1.1 From 967cbde055948f7ccbe1908a296a4d155e646009 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Sep 2009 22:25:32 +0100 Subject: correct off-by-one error in save iar command handling --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index dc201e1..196205c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) { - if (cmdparams.Length < 5) + if (cmdparams.Length < 6) { m_log.Error( "[INVENTORY ARCHIVER]: usage is save iar []"); -- cgit v1.1 From 7870152d23db4cb6f5834d4921fac17feb717220 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Sep 2009 14:54:12 +0100 Subject: Allow load/save iar password checks to be done in grid mode This should allow load/save iar to work for grid mode as long as the grid user service is later than this revision Grid services of earlier revisions will always erroneously report incorrect password. This will be addressed shortly. --- .../Inventory/Archiver/InventoryArchiverModule.cs | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 196205c..b82b940 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -322,7 +322,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// User password /// protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) - { + { CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName); if (null == userInfo) @@ -333,29 +333,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return null; } - string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); - - if (userInfo.UserProfile.PasswordHash == null || userInfo.UserProfile.PasswordHash == String.Empty) + if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass)) { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: Sorry, the grid mode service is not providing password hash details for the check. This will be fixed in an OpenSim git revision soon"); - - return null; + return userInfo; } - -// m_log.DebugFormat( -// "[INVENTORY ARCHIVER]: received salt {0}, hash {1}, supplied hash {2}", -// userInfo.UserProfile.PasswordSalt, userInfo.UserProfile.PasswordHash, md5PasswdHash); - - if (userInfo.UserProfile.PasswordHash != md5PasswdHash) + else { m_log.ErrorFormat( "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", firstName, lastName); + return null; } - - return userInfo; } /// -- cgit v1.1 From f62b5e6cec31fe496ec4b9f7dcd6ae1f4063bead Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Sep 2009 15:19:47 +0100 Subject: Produce a different error message if the user service does not have the authenticate method available --- .../Inventory/Archiver/InventoryArchiverModule.cs | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index b82b940..55dce05 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -333,16 +333,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return null; } - if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass)) - { - return userInfo; + try + { + if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass)) + { + return userInfo; + } + else + { + m_log.ErrorFormat( + "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", + firstName, lastName); + return null; + } } - else + catch (Exception e) { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", - firstName, lastName); - + m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e.Message); return null; } } @@ -364,9 +371,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { foreach (InventoryNodeBase node in loadedNodes) { - m_log.DebugFormat( - "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", - user.Name, node.Name); +// m_log.DebugFormat( +// "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", +// user.Name, node.Name); user.ControllingClient.SendBulkUpdateInventory(node); } -- cgit v1.1 From ee205e7e812e170f670e690a4e0fa9caa652f226 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 Oct 2009 01:00:09 +0900 Subject: Formatting cleanup. --- .../Inventory/Archiver/InventoryArchiverModule.cs | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 55dce05..1228eb1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -40,12 +40,12 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver -{ +{ /// /// This module loads and saves OpenSimulator inventory archives - /// + /// public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule - { + { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public string Name { get { return "Inventory Archiver Module"; } } @@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// public bool DisablePresenceChecks { get; set; } - public event InventoryArchiveSaved OnInventoryArchiveSaved; + public event InventoryArchiveSaved OnInventoryArchiveSaved; /// /// The file to load and save inventory if no filename has been specified @@ -83,7 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } public void Initialise(Scene scene, IConfigSource source) - { + { if (m_scenes.Count == 0) { scene.RegisterModuleInterface(this); @@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_aScene = scene; } - m_scenes[scene.RegionInfo.RegionID] = scene; + m_scenes[scene.RegionInfo.RegionID] = scene; } public void PostInitialise() {} @@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; if (handlerInventoryArchiveSaved != null) handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); - } + } public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) { @@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) { if (m_scenes.Count > 0) - { + { CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); if (userInfo != null) @@ -182,7 +182,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (CheckPresence(userInfo.UserProfile.ID)) { InventoryArchiveReadRequest request = - new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); + new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); UpdateClientWithLoadedNodes(userInfo, request.Execute()); return true; @@ -197,12 +197,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } return false; - } + } public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath) { if (m_scenes.Count > 0) - { + { CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); if (userInfo != null) @@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (CheckPresence(userInfo.UserProfile.ID)) { InventoryArchiveReadRequest request = - new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); + new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); UpdateClientWithLoadedNodes(userInfo, request.Execute()); return true; @@ -221,11 +221,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator", userInfo.UserProfile.Name, userInfo.UserProfile.ID); } - } + } } return false; - } + } /// /// Load inventory from an inventory file archive @@ -252,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", loadPath, invPath, firstName, lastName); - if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath)) + if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath)) m_log.InfoFormat( "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", loadPath, firstName, lastName); @@ -288,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver lock (m_pendingConsoleSaves) m_pendingConsoleSaves.Add(id); - } + } private void SaveInvConsoleCommandCompleted( Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, @@ -322,7 +322,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// User password /// protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) - { + { CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName); if (null == userInfo) @@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } try - { + { if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass)) { return userInfo; @@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { m_log.ErrorFormat( "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", - firstName, lastName); + firstName, lastName); return null; } } @@ -359,7 +359,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// Can be empty. In which case, nothing happens private void UpdateClientWithLoadedNodes(CachedUserInfo userInfo, List loadedNodes) - { + { if (loadedNodes.Count == 0) return; @@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver ScenePresence user = scene.GetScenePresence(userInfo.UserProfile.ID); if (user != null && !user.IsChildAgent) - { + { foreach (InventoryNodeBase node in loadedNodes) { // m_log.DebugFormat( @@ -379,8 +379,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } break; - } - } + } + } } /// -- cgit v1.1