aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs')
-rw-r--r--OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs39
1 files changed, 26 insertions, 13 deletions
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
index 2fc9248..14d96cb 100644
--- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
@@ -60,16 +60,25 @@ namespace OpenSim.Services.AuthenticationService
60 { 60 {
61 AuthenticationData data = m_Database.Get(principalID); 61 AuthenticationData data = m_Database.Get(principalID);
62 62
63 if (data != null && data.Data != null) 63 if (data == null)
64 { 64 {
65 if (!data.Data.ContainsKey("passwordHash") || 65 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} not found", principalID);
66 !data.Data.ContainsKey("passwordSalt")) 66 return String.Empty;
67 { 67 }
68 return String.Empty; 68 else if (data.Data == null)
69 } 69 {
70 70 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} data not found", principalID);
71 string hashed = Util.Md5Hash(password + ":" + 71 return String.Empty;
72 data.Data["passwordSalt"].ToString()); 72 }
73 else if (!data.Data.ContainsKey("passwordHash") || !data.Data.ContainsKey("passwordSalt"))
74 {
75 m_log.DebugFormat(
76 "[AUTH SERVICE]: PrincipalID {0} data didn't contain either passwordHash or passwordSalt", principalID);
77 return String.Empty;
78 }
79 else
80 {
81 string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString());
73 82
74 //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); 83 //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString());
75 84
@@ -77,10 +86,14 @@ namespace OpenSim.Services.AuthenticationService
77 { 86 {
78 return GetToken(principalID, lifetime); 87 return GetToken(principalID, lifetime);
79 } 88 }
89 else
90 {
91 m_log.DebugFormat(
92 "[AUTH SERVICE]: Salted hash {0} of given password did not match salted hash of {1} for PrincipalID {2}. Authentication failure.",
93 principalID);
94 return String.Empty;
95 }
80 } 96 }
81
82 m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID);
83 return String.Empty;
84 } 97 }
85 } 98 }
86} 99} \ No newline at end of file