aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs72
1 files changed, 41 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 9f49da9..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;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41 41
42namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver 42namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
43{ 43{
44 /// <summary> 44 /// <summary>
45 /// This module loads and saves OpenSimulator inventory archives 45 /// This module loads and saves OpenSimulator inventory archives
46 /// </summary> 46 /// </summary>
47 public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule 47 public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule
48 { 48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 public string Name { get { return "Inventory Archiver Module"; } } 51 public string Name { get { return "Inventory Archiver Module"; } }
@@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
57 /// </value> 57 /// </value>
58 public bool DisablePresenceChecks { get; set; } 58 public bool DisablePresenceChecks { get; set; }
59 59
60 public event InventoryArchiveSaved OnInventoryArchiveSaved; 60 public event InventoryArchiveSaved OnInventoryArchiveSaved;
61 61
62 /// <summary> 62 /// <summary>
63 /// The file to load and save inventory if no filename has been specified 63 /// The file to load and save inventory if no filename has been specified
@@ -83,7 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
83 } 83 }
84 84
85 public void Initialise(Scene scene, IConfigSource source) 85 public void Initialise(Scene scene, IConfigSource source)
86 { 86 {
87 if (m_scenes.Count == 0) 87 if (m_scenes.Count == 0)
88 { 88 {
89 scene.RegisterModuleInterface<IInventoryArchiverModule>(this); 89 scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
102 m_aScene = scene; 102 m_aScene = scene;
103 } 103 }
104 104
105 m_scenes[scene.RegionInfo.RegionID] = scene; 105 m_scenes[scene.RegionInfo.RegionID] = scene;
106 } 106 }
107 107
108 public void PostInitialise() {} 108 public void PostInitialise() {}
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
119 InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; 119 InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
120 if (handlerInventoryArchiveSaved != null) 120 if (handlerInventoryArchiveSaved != null)
121 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); 121 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
122 } 122 }
123 123
124 public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) 124 public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
125 { 125 {
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
174 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) 174 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream)
175 { 175 {
176 if (m_scenes.Count > 0) 176 if (m_scenes.Count > 0)
177 { 177 {
178 CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); 178 CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
179 179
180 if (userInfo != null) 180 if (userInfo != null)
@@ -182,7 +182,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
182 if (CheckPresence(userInfo.UserProfile.ID)) 182 if (CheckPresence(userInfo.UserProfile.ID))
183 { 183 {
184 InventoryArchiveReadRequest request = 184 InventoryArchiveReadRequest request =
185 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); 185 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
186 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 186 UpdateClientWithLoadedNodes(userInfo, request.Execute());
187 187
188 return true; 188 return true;
@@ -197,12 +197,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
197 } 197 }
198 198
199 return false; 199 return false;
200 } 200 }
201 201
202 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath) 202 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath)
203 { 203 {
204 if (m_scenes.Count > 0) 204 if (m_scenes.Count > 0)
205 { 205 {
206 CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); 206 CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
207 207
208 if (userInfo != null) 208 if (userInfo != null)
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
210 if (CheckPresence(userInfo.UserProfile.ID)) 210 if (CheckPresence(userInfo.UserProfile.ID))
211 { 211 {
212 InventoryArchiveReadRequest request = 212 InventoryArchiveReadRequest request =
213 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); 213 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
214 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 214 UpdateClientWithLoadedNodes(userInfo, request.Execute());
215 215
216 return true; 216 return true;
@@ -221,11 +221,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
221 "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator", 221 "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator",
222 userInfo.UserProfile.Name, userInfo.UserProfile.ID); 222 userInfo.UserProfile.Name, userInfo.UserProfile.ID);
223 } 223 }
224 } 224 }
225 } 225 }
226 226
227 return false; 227 return false;
228 } 228 }
229 229
230 /// <summary> 230 /// <summary>
231 /// Load inventory from an inventory file archive 231 /// Load inventory from an inventory file archive
@@ -252,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
252 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", 252 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
253 loadPath, invPath, firstName, lastName); 253 loadPath, invPath, firstName, lastName);
254 254
255 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath)) 255 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath))
256 m_log.InfoFormat( 256 m_log.InfoFormat(
257 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 257 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
258 loadPath, firstName, lastName); 258 loadPath, firstName, lastName);
@@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
264 /// <param name="cmdparams"></param> 264 /// <param name="cmdparams"></param>
265 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) 265 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
266 { 266 {
267 if (cmdparams.Length < 5) 267 if (cmdparams.Length < 6)
268 { 268 {
269 m_log.Error( 269 m_log.Error(
270 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); 270 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
@@ -288,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
288 288
289 lock (m_pendingConsoleSaves) 289 lock (m_pendingConsoleSaves)
290 m_pendingConsoleSaves.Add(id); 290 m_pendingConsoleSaves.Add(id);
291 } 291 }
292 292
293 private void SaveInvConsoleCommandCompleted( 293 private void SaveInvConsoleCommandCompleted(
294 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, 294 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream,
@@ -324,6 +324,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
324 protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) 324 protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass)
325 { 325 {
326 CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); 326 CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
327 //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName);
327 if (null == userInfo) 328 if (null == userInfo)
328 { 329 {
329 m_log.ErrorFormat( 330 m_log.ErrorFormat(
@@ -332,16 +333,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
332 return null; 333 return null;
333 } 334 }
334 335
335 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); 336 try
336 if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
337 { 337 {
338 m_log.ErrorFormat( 338 if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass))
339 "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", 339 {
340 firstName, lastName); 340 return userInfo;
341 }
342 else
343 {
344 m_log.ErrorFormat(
345 "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.",
346 firstName, lastName);
347 return null;
348 }
349 }
350 catch (Exception e)
351 {
352 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e.Message);
341 return null; 353 return null;
342 } 354 }
343
344 return userInfo;
345 } 355 }
346 356
347 /// <summary> 357 /// <summary>
@@ -349,7 +359,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
349 /// </summary> 359 /// </summary>
350 /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param> 360 /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param>
351 private void UpdateClientWithLoadedNodes(CachedUserInfo userInfo, List<InventoryNodeBase> loadedNodes) 361 private void UpdateClientWithLoadedNodes(CachedUserInfo userInfo, List<InventoryNodeBase> loadedNodes)
352 { 362 {
353 if (loadedNodes.Count == 0) 363 if (loadedNodes.Count == 0)
354 return; 364 return;
355 365
@@ -358,19 +368,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
358 ScenePresence user = scene.GetScenePresence(userInfo.UserProfile.ID); 368 ScenePresence user = scene.GetScenePresence(userInfo.UserProfile.ID);
359 369
360 if (user != null && !user.IsChildAgent) 370 if (user != null && !user.IsChildAgent)
361 { 371 {
362 foreach (InventoryNodeBase node in loadedNodes) 372 foreach (InventoryNodeBase node in loadedNodes)
363 { 373 {
364 m_log.DebugFormat( 374// m_log.DebugFormat(
365 "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", 375// "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}",
366 user.Name, node.Name); 376// user.Name, node.Name);
367 377
368 user.ControllingClient.SendBulkUpdateInventory(node); 378 user.ControllingClient.SendBulkUpdateInventory(node);
369 } 379 }
370 380
371 break; 381 break;
372 } 382 }
373 } 383 }
374 } 384 }
375 385
376 /// <summary> 386 /// <summary>