diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 125 |
1 files changed, 89 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index ecd60bd..71b3062 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -34,7 +34,7 @@ using Nini.Config; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Communications.Cache; | 37 | |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
113 | /// Trigger the inventory archive saved event. | 113 | /// Trigger the inventory archive saved event. |
114 | /// </summary> | 114 | /// </summary> |
115 | protected internal void TriggerInventoryArchiveSaved( | 115 | protected internal void TriggerInventoryArchiveSaved( |
116 | Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, | 116 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
117 | Exception reportedException) | 117 | Exception reportedException) |
118 | { | 118 | { |
119 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; | 119 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; |
@@ -125,20 +125,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
125 | { | 125 | { |
126 | if (m_scenes.Count > 0) | 126 | if (m_scenes.Count > 0) |
127 | { | 127 | { |
128 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); | 128 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
129 | 129 | ||
130 | if (userInfo != null) | 130 | if (userInfo != null) |
131 | { | 131 | { |
132 | if (CheckPresence(userInfo.UserProfile.ID)) | 132 | if (CheckPresence(userInfo.PrincipalID)) |
133 | { | 133 | { |
134 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(); | 134 | try |
135 | { | ||
136 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(); | ||
137 | } | ||
138 | catch (EntryPointNotFoundException e) | ||
139 | { | ||
140 | m_log.ErrorFormat( | ||
141 | "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." | ||
142 | + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); | ||
143 | m_log.Error(e); | ||
144 | |||
145 | return false; | ||
146 | } | ||
147 | |||
135 | return true; | 148 | return true; |
136 | } | 149 | } |
137 | else | 150 | else |
138 | { | 151 | { |
139 | m_log.ErrorFormat( | 152 | m_log.ErrorFormat( |
140 | "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator", | 153 | "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", |
141 | userInfo.UserProfile.Name, userInfo.UserProfile.ID); | 154 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
142 | } | 155 | } |
143 | } | 156 | } |
144 | } | 157 | } |
@@ -150,20 +163,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
150 | { | 163 | { |
151 | if (m_scenes.Count > 0) | 164 | if (m_scenes.Count > 0) |
152 | { | 165 | { |
153 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); | 166 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
154 | 167 | ||
155 | if (userInfo != null) | 168 | if (userInfo != null) |
156 | { | 169 | { |
157 | if (CheckPresence(userInfo.UserProfile.ID)) | 170 | if (CheckPresence(userInfo.PrincipalID)) |
158 | { | 171 | { |
159 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(); | 172 | try |
173 | { | ||
174 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(); | ||
175 | } | ||
176 | catch (EntryPointNotFoundException e) | ||
177 | { | ||
178 | m_log.ErrorFormat( | ||
179 | "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." | ||
180 | + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); | ||
181 | m_log.Error(e); | ||
182 | |||
183 | return false; | ||
184 | } | ||
185 | |||
160 | return true; | 186 | return true; |
161 | } | 187 | } |
162 | else | 188 | else |
163 | { | 189 | { |
164 | m_log.ErrorFormat( | 190 | m_log.ErrorFormat( |
165 | "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator", | 191 | "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", |
166 | userInfo.UserProfile.Name, userInfo.UserProfile.ID); | 192 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
167 | } | 193 | } |
168 | } | 194 | } |
169 | } | 195 | } |
@@ -175,14 +201,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
175 | { | 201 | { |
176 | if (m_scenes.Count > 0) | 202 | if (m_scenes.Count > 0) |
177 | { | 203 | { |
178 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); | 204 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
179 | 205 | ||
180 | if (userInfo != null) | 206 | if (userInfo != null) |
181 | { | 207 | { |
182 | if (CheckPresence(userInfo.UserProfile.ID)) | 208 | if (CheckPresence(userInfo.PrincipalID)) |
183 | { | 209 | { |
184 | InventoryArchiveReadRequest request = | 210 | InventoryArchiveReadRequest request; |
185 | new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); | 211 | |
212 | try | ||
213 | { | ||
214 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); | ||
215 | } | ||
216 | catch (EntryPointNotFoundException e) | ||
217 | { | ||
218 | m_log.ErrorFormat( | ||
219 | "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." | ||
220 | + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); | ||
221 | m_log.Error(e); | ||
222 | |||
223 | return false; | ||
224 | } | ||
225 | |||
186 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 226 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
187 | 227 | ||
188 | return true; | 228 | return true; |
@@ -190,8 +230,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
190 | else | 230 | else |
191 | { | 231 | { |
192 | m_log.ErrorFormat( | 232 | m_log.ErrorFormat( |
193 | "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator", | 233 | "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", |
194 | userInfo.UserProfile.Name, userInfo.UserProfile.ID); | 234 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
195 | } | 235 | } |
196 | } | 236 | } |
197 | } | 237 | } |
@@ -203,14 +243,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
203 | { | 243 | { |
204 | if (m_scenes.Count > 0) | 244 | if (m_scenes.Count > 0) |
205 | { | 245 | { |
206 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); | 246 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
207 | 247 | ||
208 | if (userInfo != null) | 248 | if (userInfo != null) |
209 | { | 249 | { |
210 | if (CheckPresence(userInfo.UserProfile.ID)) | 250 | if (CheckPresence(userInfo.PrincipalID)) |
211 | { | 251 | { |
212 | InventoryArchiveReadRequest request = | 252 | InventoryArchiveReadRequest request; |
213 | new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); | 253 | |
254 | try | ||
255 | { | ||
256 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); | ||
257 | } | ||
258 | catch (EntryPointNotFoundException e) | ||
259 | { | ||
260 | m_log.ErrorFormat( | ||
261 | "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." | ||
262 | + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); | ||
263 | m_log.Error(e); | ||
264 | |||
265 | return false; | ||
266 | } | ||
267 | |||
214 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 268 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
215 | 269 | ||
216 | return true; | 270 | return true; |
@@ -218,8 +272,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
218 | else | 272 | else |
219 | { | 273 | { |
220 | m_log.ErrorFormat( | 274 | m_log.ErrorFormat( |
221 | "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator", | 275 | "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", |
222 | userInfo.UserProfile.Name, userInfo.UserProfile.ID); | 276 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
223 | } | 277 | } |
224 | } | 278 | } |
225 | } | 279 | } |
@@ -291,7 +345,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
291 | } | 345 | } |
292 | 346 | ||
293 | private void SaveInvConsoleCommandCompleted( | 347 | private void SaveInvConsoleCommandCompleted( |
294 | Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, | 348 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
295 | Exception reportedException) | 349 | Exception reportedException) |
296 | { | 350 | { |
297 | lock (m_pendingConsoleSaves) | 351 | lock (m_pendingConsoleSaves) |
@@ -304,13 +358,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
304 | 358 | ||
305 | if (succeeded) | 359 | if (succeeded) |
306 | { | 360 | { |
307 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0}", userInfo.UserProfile.Name); | 361 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); |
308 | } | 362 | } |
309 | else | 363 | else |
310 | { | 364 | { |
311 | m_log.ErrorFormat( | 365 | m_log.ErrorFormat( |
312 | "[INVENTORY ARCHIVER]: Archive save for {0} failed - {1}", | 366 | "[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}", |
313 | userInfo.UserProfile.Name, reportedException.Message); | 367 | userInfo.FirstName, userInfo.LastName, reportedException.Message); |
314 | } | 368 | } |
315 | } | 369 | } |
316 | 370 | ||
@@ -321,11 +375,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
321 | /// <param name="lastName"></param> | 375 | /// <param name="lastName"></param> |
322 | /// <param name="pass">User password</param> | 376 | /// <param name="pass">User password</param> |
323 | /// <returns></returns> | 377 | /// <returns></returns> |
324 | protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) | 378 | protected UserAccount GetUserInfo(string firstName, string lastName, string pass) |
325 | { | 379 | { |
326 | CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); | 380 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); |
327 | //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName); | 381 | if (null == account) |
328 | if (null == userInfo) | ||
329 | { | 382 | { |
330 | m_log.ErrorFormat( | 383 | m_log.ErrorFormat( |
331 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", | 384 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", |
@@ -335,9 +388,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
335 | 388 | ||
336 | try | 389 | try |
337 | { | 390 | { |
338 | if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass)) | 391 | if (m_aScene.AuthenticationService.Authenticate(account.PrincipalID, pass, 1) != string.Empty) |
339 | { | 392 | { |
340 | return userInfo; | 393 | return account; |
341 | } | 394 | } |
342 | else | 395 | else |
343 | { | 396 | { |
@@ -358,14 +411,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
358 | /// Notify the client of loaded nodes if they are logged in | 411 | /// Notify the client of loaded nodes if they are logged in |
359 | /// </summary> | 412 | /// </summary> |
360 | /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param> | 413 | /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param> |
361 | private void UpdateClientWithLoadedNodes(CachedUserInfo userInfo, List<InventoryNodeBase> loadedNodes) | 414 | private void UpdateClientWithLoadedNodes(UserAccount userInfo, List<InventoryNodeBase> loadedNodes) |
362 | { | 415 | { |
363 | if (loadedNodes.Count == 0) | 416 | if (loadedNodes.Count == 0) |
364 | return; | 417 | return; |
365 | 418 | ||
366 | foreach (Scene scene in m_scenes.Values) | 419 | foreach (Scene scene in m_scenes.Values) |
367 | { | 420 | { |
368 | ScenePresence user = scene.GetScenePresence(userInfo.UserProfile.ID); | 421 | ScenePresence user = scene.GetScenePresence(userInfo.PrincipalID); |
369 | 422 | ||
370 | if (user != null && !user.IsChildAgent) | 423 | if (user != null && !user.IsChildAgent) |
371 | { | 424 | { |