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.cs49
1 files changed, 35 insertions, 14 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;