diff options
author | Justin Clark-Casey (justincc) | 2009-09-16 18:20:55 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-16 18:20:55 +0100 |
commit | 35260faead29c590bf01c1eb02130cfac22c38ad (patch) | |
tree | a2a8e6bc038440311bcdda6cfd9331af47e0059f /OpenSim/Region/CoreModules/Avatar | |
parent | This fix allows you to configure a script-to-console-log channel (diff) | |
download | opensim-SC-35260faead29c590bf01c1eb02130cfac22c38ad.zip opensim-SC-35260faead29c590bf01c1eb02130cfac22c38ad.tar.gz opensim-SC-35260faead29c590bf01c1eb02130cfac22c38ad.tar.bz2 opensim-SC-35260faead29c590bf01c1eb02130cfac22c38ad.tar.xz |
on iar save/load, let the user know if they put in the wrong password
refactor GetUserInfo() to eliminate copypasta
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 1937637..9f49da9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -125,10 +125,7 @@ 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); | 128 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); |
129 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); | ||
130 | if (userInfo.UserProfile.PasswordHash != md5PasswdHash) | ||
131 | return false; | ||
132 | 129 | ||
133 | if (userInfo != null) | 130 | if (userInfo != null) |
134 | { | 131 | { |
@@ -153,11 +150,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
153 | { | 150 | { |
154 | if (m_scenes.Count > 0) | 151 | if (m_scenes.Count > 0) |
155 | { | 152 | { |
156 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName); | 153 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); |
157 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); | ||
158 | if (userInfo.UserProfile.PasswordHash != md5PasswdHash) | ||
159 | return false; | ||
160 | |||
161 | 154 | ||
162 | if (userInfo != null) | 155 | if (userInfo != null) |
163 | { | 156 | { |
@@ -182,11 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
182 | { | 175 | { |
183 | if (m_scenes.Count > 0) | 176 | if (m_scenes.Count > 0) |
184 | { | 177 | { |
185 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName); | 178 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); |
186 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); | ||
187 | if (userInfo.UserProfile.PasswordHash != md5PasswdHash) | ||
188 | return false; | ||
189 | |||
190 | 179 | ||
191 | if (userInfo != null) | 180 | if (userInfo != null) |
192 | { | 181 | { |
@@ -214,11 +203,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
214 | { | 203 | { |
215 | if (m_scenes.Count > 0) | 204 | if (m_scenes.Count > 0) |
216 | { | 205 | { |
217 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName); | 206 | CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); |
218 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); | ||
219 | if (userInfo.UserProfile.PasswordHash != md5PasswdHash) | ||
220 | return false; | ||
221 | |||
222 | 207 | ||
223 | if (userInfo != null) | 208 | if (userInfo != null) |
224 | { | 209 | { |
@@ -251,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
251 | if (cmdparams.Length < 6) | 236 | if (cmdparams.Length < 6) |
252 | { | 237 | { |
253 | m_log.Error( | 238 | m_log.Error( |
254 | "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <password> [<load file path>]"); | 239 | "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]"); |
255 | return; | 240 | return; |
256 | } | 241 | } |
257 | 242 | ||
@@ -282,7 +267,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
282 | if (cmdparams.Length < 5) | 267 | if (cmdparams.Length < 5) |
283 | { | 268 | { |
284 | m_log.Error( | 269 | m_log.Error( |
285 | "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <password> [<save file path>]"); | 270 | "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); |
286 | return; | 271 | return; |
287 | } | 272 | } |
288 | 273 | ||
@@ -334,8 +319,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
334 | /// </summary> | 319 | /// </summary> |
335 | /// <param name="firstName"></param> | 320 | /// <param name="firstName"></param> |
336 | /// <param name="lastName"></param> | 321 | /// <param name="lastName"></param> |
322 | /// <param name="pass">User password</param> | ||
337 | /// <returns></returns> | 323 | /// <returns></returns> |
338 | protected CachedUserInfo GetUserInfo(string firstName, string lastName) | 324 | protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) |
339 | { | 325 | { |
340 | CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); | 326 | CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); |
341 | if (null == userInfo) | 327 | if (null == userInfo) |
@@ -345,6 +331,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
345 | firstName, lastName); | 331 | firstName, lastName); |
346 | return null; | 332 | return null; |
347 | } | 333 | } |
334 | |||
335 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); | ||
336 | if (userInfo.UserProfile.PasswordHash != md5PasswdHash) | ||
337 | { | ||
338 | m_log.ErrorFormat( | ||
339 | "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", | ||
340 | firstName, lastName); | ||
341 | return null; | ||
342 | } | ||
348 | 343 | ||
349 | return userInfo; | 344 | return userInfo; |
350 | } | 345 | } |