aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices.UserServer/UserManager.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-05-20 23:34:29 +0000
committerAdam Frisby2007-05-20 23:34:29 +0000
commitb2fe47ecb11d4e6c6b0f9bc124cd7a8d4703784d (patch)
tree18de3f48a8afa7bb2e03063bf026ab43765d4088 /OpenGridServices.UserServer/UserManager.cs
parentFinished adding comments (diff)
downloadopensim-SC_OLD-b2fe47ecb11d4e6c6b0f9bc124cd7a8d4703784d.zip
opensim-SC_OLD-b2fe47ecb11d4e6c6b0f9bc124cd7a8d4703784d.tar.gz
opensim-SC_OLD-b2fe47ecb11d4e6c6b0f9bc124cd7a8d4703784d.tar.bz2
opensim-SC_OLD-b2fe47ecb11d4e6c6b0f9bc124cd7a8d4703784d.tar.xz
* 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
Diffstat (limited to '')
-rw-r--r--OpenGridServices.UserServer/UserManager.cs31
1 files changed, 19 insertions, 12 deletions
diff --git a/OpenGridServices.UserServer/UserManager.cs b/OpenGridServices.UserServer/UserManager.cs
index b579732..a312445 100644
--- a/OpenGridServices.UserServer/UserManager.cs
+++ b/OpenGridServices.UserServer/UserManager.cs
@@ -114,7 +114,14 @@ namespace OpenGridServices.UserServer
114 try 114 try
115 { 115 {
116 UserProfileData profile = plugin.Value.getUserByName(fname,lname); 116 UserProfileData profile = plugin.Value.getUserByName(fname,lname);
117 profile.currentAgent = getUserAgent(profile.UUID); 117 try
118 {
119 profile.currentAgent = getUserAgent(profile.UUID);
120 }
121 catch (Exception e)
122 {
123 // Ignore
124 }
118 return profile; 125 return profile;
119 } 126 }
120 catch (Exception e) 127 catch (Exception e)
@@ -295,18 +302,13 @@ namespace OpenGridServices.UserServer
295 /// <returns>Authenticated?</returns> 302 /// <returns>Authenticated?</returns>
296 public bool AuthenticateUser(ref UserProfileData profile, string password) 303 public bool AuthenticateUser(ref UserProfileData profile, string password)
297 { 304 {
298 password = password.Remove(0, 3); //remove $1$ 305 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(
306 OpenSim.Framework.Console.LogPriority.LOW,
307 "Authenticating " + profile.username + " " + profile.surname);
299 308
300 MD5CryptoServiceProvider MD5summer = new MD5CryptoServiceProvider(); 309 password = password.Remove(0, 3); //remove $1$
301
302 byte[] byteString = System.Text.Encoding.ASCII.GetBytes(password + ":" + profile.passwordSalt);
303 310
304 byteString = MD5summer.ComputeHash(byteString); 311 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
305 System.Text.StringBuilder s = new System.Text.StringBuilder();
306 foreach (byte b in byteString)
307 {
308 s.Append(b.ToString("x2").ToLower());
309 }
310 312
311 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); 313 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
312 } 314 }
@@ -360,7 +362,9 @@ namespace OpenGridServices.UserServer
360 362
361 // Current location 363 // Current location
362 agent.regionID = new LLUUID(); // Fill in later 364 agent.regionID = new LLUUID(); // Fill in later
363 agent.currentRegion = ""; // Fill in later 365 agent.currentRegion = new LLUUID(); // Fill in later
366
367 profile.currentAgent = agent;
364 } 368 }
365 369
366 /// <summary> 370 /// <summary>
@@ -399,6 +403,9 @@ namespace OpenGridServices.UserServer
399 passwd = (string)requestData["passwd"]; 403 passwd = (string)requestData["passwd"];
400 404
401 TheUser = getUserProfile(firstname, lastname); 405 TheUser = getUserProfile(firstname, lastname);
406 if (TheUser == null)
407 return CreateLoginErrorResponse();
408
402 GoodLogin = AuthenticateUser(ref TheUser, passwd); 409 GoodLogin = AuthenticateUser(ref TheUser, passwd);
403 } 410 }
404 else 411 else