aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-03-02 21:12:53 -0800
committerDiva Canto2010-03-02 21:12:53 -0800
commitd167686adb2d4a08759cf7c23ced9d9edd209b77 (patch)
tree54dc5dbfbb8d6daf71499d07ac4526569f828113 /OpenSim
parent* Better debug message on login problems. (diff)
downloadopensim-SC_OLD-d167686adb2d4a08759cf7c23ced9d9edd209b77.zip
opensim-SC_OLD-d167686adb2d4a08759cf7c23ced9d9edd209b77.tar.gz
opensim-SC_OLD-d167686adb2d4a08759cf7c23ced9d9edd209b77.tar.bz2
opensim-SC_OLD-d167686adb2d4a08759cf7c23ced9d9edd209b77.tar.xz
Better error handling on PasswordAuthenticationService
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs32
1 files changed, 18 insertions, 14 deletions
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
index 021dcf3..2fc9248 100644
--- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
@@ -47,9 +47,9 @@ namespace OpenSim.Services.AuthenticationService
47 public class PasswordAuthenticationService : 47 public class PasswordAuthenticationService :
48 AuthenticationServiceBase, IAuthenticationService 48 AuthenticationServiceBase, IAuthenticationService
49 { 49 {
50 //private static readonly ILog m_log = 50 private static readonly ILog m_log =
51 // LogManager.GetLogger( 51 LogManager.GetLogger(
52 // MethodBase.GetCurrentMethod().DeclaringType); 52 MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 public PasswordAuthenticationService(IConfigSource config) : 54 public PasswordAuthenticationService(IConfigSource config) :
55 base(config) 55 base(config)
@@ -59,23 +59,27 @@ namespace OpenSim.Services.AuthenticationService
59 public string Authenticate(UUID principalID, string password, int lifetime) 59 public string Authenticate(UUID principalID, string password, int lifetime)
60 { 60 {
61 AuthenticationData data = m_Database.Get(principalID); 61 AuthenticationData data = m_Database.Get(principalID);
62 62
63 if (!data.Data.ContainsKey("passwordHash") || 63 if (data != null && data.Data != null)
64 !data.Data.ContainsKey("passwordSalt"))
65 { 64 {
66 return String.Empty; 65 if (!data.Data.ContainsKey("passwordHash") ||
67 } 66 !data.Data.ContainsKey("passwordSalt"))
67 {
68 return String.Empty;
69 }
68 70
69 string hashed = Util.Md5Hash(password + ":" + 71 string hashed = Util.Md5Hash(password + ":" +
70 data.Data["passwordSalt"].ToString()); 72 data.Data["passwordSalt"].ToString());
71 73
72 //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); 74 //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString());
73 75
74 if (data.Data["passwordHash"].ToString() == hashed) 76 if (data.Data["passwordHash"].ToString() == hashed)
75 { 77 {
76 return GetToken(principalID, lifetime); 78 return GetToken(principalID, lifetime);
79 }
77 } 80 }
78 81
82 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID);
79 return String.Empty; 83 return String.Empty;
80 } 84 }
81 } 85 }