mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
* Minor tweaks with new userserver
* Fixed password encoding to match MD5 standard properly. * Fixed exception caused on user first login (minor) * Fixed exception caused by incorrect username (minor) * Returns login error rather than grid error if username is incorrect
This commit is contained in:
@@ -114,7 +114,14 @@ namespace OpenGridServices.UserServer
|
||||
try
|
||||
{
|
||||
UserProfileData profile = plugin.Value.getUserByName(fname,lname);
|
||||
profile.currentAgent = getUserAgent(profile.UUID);
|
||||
try
|
||||
{
|
||||
profile.currentAgent = getUserAgent(profile.UUID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -295,18 +302,13 @@ namespace OpenGridServices.UserServer
|
||||
/// <returns>Authenticated?</returns>
|
||||
public bool AuthenticateUser(ref UserProfileData profile, string password)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(
|
||||
OpenSim.Framework.Console.LogPriority.LOW,
|
||||
"Authenticating " + profile.username + " " + profile.surname);
|
||||
|
||||
password = password.Remove(0, 3); //remove $1$
|
||||
|
||||
MD5CryptoServiceProvider MD5summer = new MD5CryptoServiceProvider();
|
||||
|
||||
byte[] byteString = System.Text.Encoding.ASCII.GetBytes(password + ":" + profile.passwordSalt);
|
||||
|
||||
byteString = MD5summer.ComputeHash(byteString);
|
||||
System.Text.StringBuilder s = new System.Text.StringBuilder();
|
||||
foreach (byte b in byteString)
|
||||
{
|
||||
s.Append(b.ToString("x2").ToLower());
|
||||
}
|
||||
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
|
||||
|
||||
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
@@ -360,7 +362,9 @@ namespace OpenGridServices.UserServer
|
||||
|
||||
// Current location
|
||||
agent.regionID = new LLUUID(); // Fill in later
|
||||
agent.currentRegion = ""; // Fill in later
|
||||
agent.currentRegion = new LLUUID(); // Fill in later
|
||||
|
||||
profile.currentAgent = agent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -399,6 +403,9 @@ namespace OpenGridServices.UserServer
|
||||
passwd = (string)requestData["passwd"];
|
||||
|
||||
TheUser = getUserProfile(firstname, lastname);
|
||||
if (TheUser == null)
|
||||
return CreateLoginErrorResponse();
|
||||
|
||||
GoodLogin = AuthenticateUser(ref TheUser, passwd);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user