aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs49
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs14
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs6
3 files changed, 45 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 00faabb..1937637 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
91 91
92 scene.AddCommand( 92 scene.AddCommand(
93 this, "load iar", 93 this, "load iar",
94 "load iar <first> <last> <inventory path> [<archive path>]", 94 "load iar <first> <last> <inventory path> <password> [<archive path>]",
95 "Load user inventory archive. EXPERIMENTAL", HandleLoadInvConsoleCommand); 95 "Load user inventory archive. EXPERIMENTAL", HandleLoadInvConsoleCommand);
96 96
97 scene.AddCommand( 97 scene.AddCommand(
98 this, "save iar", 98 this, "save iar",
99 "save iar <first> <last> <inventory path> [<archive path>]", 99 "save iar <first> <last> <inventory path> <password> [<archive path>]",
100 "Save user inventory archive. EXPERIMENTAL", HandleSaveInvConsoleCommand); 100 "Save user inventory archive. EXPERIMENTAL", HandleSaveInvConsoleCommand);
101 101
102 m_aScene = scene; 102 m_aScene = scene;
@@ -121,11 +121,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
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, Stream saveStream) 124 public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
125 { 125 {
126 if (m_scenes.Count > 0) 126 if (m_scenes.Count > 0)
127 { 127 {
128 CachedUserInfo userInfo = GetUserInfo(firstName, lastName); 128 CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
129 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
130 if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
131 return false;
129 132
130 if (userInfo != null) 133 if (userInfo != null)
131 { 134 {
@@ -146,11 +149,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
146 return false; 149 return false;
147 } 150 }
148 151
149 public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string savePath) 152 public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, string savePath)
150 { 153 {
151 if (m_scenes.Count > 0) 154 if (m_scenes.Count > 0)
152 { 155 {
153 CachedUserInfo userInfo = GetUserInfo(firstName, lastName); 156 CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
157 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
158 if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
159 return false;
160
154 161
155 if (userInfo != null) 162 if (userInfo != null)
156 { 163 {
@@ -171,11 +178,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
171 return false; 178 return false;
172 } 179 }
173 180
174 public bool DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream) 181 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream)
175 { 182 {
176 if (m_scenes.Count > 0) 183 if (m_scenes.Count > 0)
177 { 184 {
178 CachedUserInfo userInfo = GetUserInfo(firstName, lastName); 185 CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
186 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
187 if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
188 return false;
189
179 190
180 if (userInfo != null) 191 if (userInfo != null)
181 { 192 {
@@ -199,11 +210,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
199 return false; 210 return false;
200 } 211 }
201 212
202 public bool DearchiveInventory(string firstName, string lastName, string invPath, string loadPath) 213 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath)
203 { 214 {
204 if (m_scenes.Count > 0) 215 if (m_scenes.Count > 0)
205 { 216 {
206 CachedUserInfo userInfo = GetUserInfo(firstName, lastName); 217 CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
218 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
219 if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
220 return false;
221
207 222
208 if (userInfo != null) 223 if (userInfo != null)
209 { 224 {
@@ -233,10 +248,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
233 /// <param name="cmdparams"></param> 248 /// <param name="cmdparams"></param>
234 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) 249 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
235 { 250 {
236 if (cmdparams.Length < 5) 251 if (cmdparams.Length < 6)
237 { 252 {
238 m_log.Error( 253 m_log.Error(
239 "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> [<load file path>]"); 254 "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <password> [<load file path>]");
240 return; 255 return;
241 } 256 }
242 257
@@ -245,13 +260,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
245 string firstName = cmdparams[2]; 260 string firstName = cmdparams[2];
246 string lastName = cmdparams[3]; 261 string lastName = cmdparams[3];
247 string invPath = cmdparams[4]; 262 string invPath = cmdparams[4];
248 string loadPath = (cmdparams.Length > 5 ? cmdparams[5] : DEFAULT_INV_BACKUP_FILENAME); 263 string pass = cmdparams[5];
264 string loadPath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
249 265
250 m_log.InfoFormat( 266 m_log.InfoFormat(
251 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", 267 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
252 loadPath, invPath, firstName, lastName); 268 loadPath, invPath, firstName, lastName);
253 269
254 if (DearchiveInventory(firstName, lastName, invPath, loadPath)) 270 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath))
255 m_log.InfoFormat( 271 m_log.InfoFormat(
256 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 272 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
257 loadPath, firstName, lastName); 273 loadPath, firstName, lastName);
@@ -266,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
266 if (cmdparams.Length < 5) 282 if (cmdparams.Length < 5)
267 { 283 {
268 m_log.Error( 284 m_log.Error(
269 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> [<save file path>]"); 285 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <password> [<save file path>]");
270 return; 286 return;
271 } 287 }
272 288
@@ -275,14 +291,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
275 string firstName = cmdparams[2]; 291 string firstName = cmdparams[2];
276 string lastName = cmdparams[3]; 292 string lastName = cmdparams[3];
277 string invPath = cmdparams[4]; 293 string invPath = cmdparams[4];
278 string savePath = (cmdparams.Length > 5 ? cmdparams[5] : DEFAULT_INV_BACKUP_FILENAME); 294 string pass = cmdparams[5];
295 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
279 296
280 m_log.InfoFormat( 297 m_log.InfoFormat(
281 "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}", 298 "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}",
282 savePath, invPath, firstName, lastName); 299 savePath, invPath, firstName, lastName);
283 300
284 Guid id = Guid.NewGuid(); 301 Guid id = Guid.NewGuid();
285 ArchiveInventory(id, firstName, lastName, invPath, savePath); 302 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath);
286 303
287 lock (m_pendingConsoleSaves) 304 lock (m_pendingConsoleSaves)
288 m_pendingConsoleSaves.Add(id); 305 m_pendingConsoleSaves.Add(id);
@@ -373,8 +390,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
373 390
374 foreach (Scene scene in m_scenes.Values) 391 foreach (Scene scene in m_scenes.Values)
375 { 392 {
376 if (scene.GetScenePresence(userId) != null) 393 ScenePresence p;
394 if ((p = scene.GetScenePresence(userId)) != null)
395 {
396 p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false);
377 return true; 397 return true;
398 }
378 } 399 }
379 400
380 return false; 401 return false;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index cc16c47..8a414f9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
143 143
144 mre.Reset(); 144 mre.Reset();
145 archiverModule.ArchiveInventory( 145 archiverModule.ArchiveInventory(
146 Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream); 146 Guid.NewGuid(), userFirstName, userLastName, "Objects", "troll", archiveWriteStream);
147 mre.WaitOne(60000, false); 147 mre.WaitOne(60000, false);
148 148
149 byte[] archive = archiveWriteStream.ToArray(); 149 byte[] archive = archiveWriteStream.ToArray();
@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
253 userItemCreatorFirstName, userItemCreatorLastName, "hampshire", 253 userItemCreatorFirstName, userItemCreatorLastName, "hampshire",
254 String.Empty, 1000, 1000, userItemCreatorUuid); 254 String.Empty, 1000, 1000, userItemCreatorUuid);
255 255
256 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); 256 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "troll", archiveReadStream);
257 257
258 CachedUserInfo userInfo 258 CachedUserInfo userInfo
259 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); 259 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
@@ -274,7 +274,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
274 // Now try loading to a root child folder 274 // Now try loading to a root child folder
275 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA"); 275 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA");
276 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 276 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
277 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", archiveReadStream); 277 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "troll", archiveReadStream);
278 278
279 InventoryItemBase foundItem2 279 InventoryItemBase foundItem2
280 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + itemName); 280 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + itemName);
@@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
283 // Now try loading to a more deeply nested folder 283 // Now try loading to a more deeply nested folder
284 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC"); 284 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC");
285 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 285 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
286 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", archiveReadStream); 286 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "troll", archiveReadStream);
287 287
288 InventoryItemBase foundItem3 288 InventoryItemBase foundItem3
289 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + itemName); 289 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + itemName);
@@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
343 userAdminService.AddUser( 343 userAdminService.AddUser(
344 userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); 344 userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
345 345
346 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); 346 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "troll", archiveReadStream);
347 347
348 CachedUserInfo userInfo 348 CachedUserInfo userInfo
349 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); 349 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
@@ -408,7 +408,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
408 userAdminService.AddUser( 408 userAdminService.AddUser(
409 userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); 409 userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
410 410
411 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); 411 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "troll", archiveReadStream);
412 412
413 // Check that a suitable temporary user profile has been created. 413 // Check that a suitable temporary user profile has been created.
414 UserProfileData user2Profile 414 UserProfileData user2Profile
@@ -492,4 +492,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
492 Assert.That(folder2, Is.Not.Null, "Could not find folder b"); 492 Assert.That(folder2, Is.Not.Null, "Could not find folder b");
493 } 493 }
494 } 494 }
495} \ No newline at end of file 495}
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
index ca7abf8..1622564 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
58 /// <param name="invPath">The inventory path in which to place the loaded folders and items</param> 58 /// <param name="invPath">The inventory path in which to place the loaded folders and items</param>
59 /// <param name="loadStream">The stream from which the inventory archive will be loaded</param> 59 /// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
60 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 60 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
61 bool DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream); 61 bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
62 62
63 /// <summary> 63 /// <summary>
64 /// Archive a user's inventory folder to the given stream 64 /// Archive a user's inventory folder to the given stream
@@ -69,6 +69,6 @@ namespace OpenSim.Region.Framework.Interfaces
69 /// <param name="invPath">The inventory path from which the inventory should be saved.</param> 69 /// <param name="invPath">The inventory path from which the inventory should be saved.</param>
70 /// <param name="saveStream">The stream to which the inventory archive will be saved</param> 70 /// <param name="saveStream">The stream to which the inventory archive will be saved</param>
71 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 71 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
72 bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream); 72 bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
73 } 73 }
74} \ No newline at end of file 74}