on iar save/load, let the user know if they put in the wrong password

refactor GetUserInfo() to eliminate copypasta
remotes/origin/0.6.7-post-fixes
Justin Clark-Casey (justincc) 2009-09-16 18:20:55 +01:00
parent 9cbb865985
commit 35260faead
2 changed files with 18 additions and 26 deletions

View File

@ -125,10 +125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (m_scenes.Count > 0)
{
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
return false;
CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
if (userInfo != null)
{
@ -153,11 +150,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (m_scenes.Count > 0)
{
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
return false;
CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
if (userInfo != null)
{
@ -182,11 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (m_scenes.Count > 0)
{
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
return false;
CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
if (userInfo != null)
{
@ -214,11 +203,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (m_scenes.Count > 0)
{
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
return false;
CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
if (userInfo != null)
{
@ -251,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (cmdparams.Length < 6)
{
m_log.Error(
"[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <password> [<load file path>]");
"[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]");
return;
}
@ -282,7 +267,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (cmdparams.Length < 5)
{
m_log.Error(
"[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <password> [<save file path>]");
"[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
return;
}
@ -334,8 +319,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary>
/// <param name="firstName"></param>
/// <param name="lastName"></param>
/// <param name="pass">User password</param>
/// <returns></returns>
protected CachedUserInfo GetUserInfo(string firstName, string lastName)
protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass)
{
CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
if (null == userInfo)
@ -345,6 +331,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
firstName, lastName);
return null;
}
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt);
if (userInfo.UserProfile.PasswordHash != md5PasswdHash)
{
m_log.ErrorFormat(
"[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.",
firstName, lastName);
return null;
}
return userInfo;
}

View File

@ -994,9 +994,7 @@ namespace OpenSim.Region.Framework.Scenes
// Loop it
if (m_frame == Int32.MaxValue)
m_frame = 0;
m_frame = 0;
otherMS = Environment.TickCount;
// run through all entities looking for updates (slow)
@ -1017,7 +1015,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.UpdateEntities();
}
// run through entities that have scheduled themselves for
// updates looking for updates(faster)
if (m_frame % m_update_entitiesquick == 0)