diff options
author | UbitUmarov | 2016-11-11 12:59:43 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-11 12:59:43 +0000 |
commit | 326821f66ed6286ee8b2ea6f5606d3eb902489fc (patch) | |
tree | 46ef5df8cae3b19cc40cc9bdb020008fbfb79417 /OpenSim/Services/AuthenticationService | |
parent | GetUserAccounts cannot cache null accounts (diff) | |
download | opensim-SC_OLD-326821f66ed6286ee8b2ea6f5606d3eb902489fc.zip opensim-SC_OLD-326821f66ed6286ee8b2ea6f5606d3eb902489fc.tar.gz opensim-SC_OLD-326821f66ed6286ee8b2ea6f5606d3eb902489fc.tar.bz2 opensim-SC_OLD-326821f66ed6286ee8b2ea6f5606d3eb902489fc.tar.xz |
reduce useraccouts cache time
Diffstat (limited to 'OpenSim/Services/AuthenticationService')
-rw-r--r-- | OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index a9359f3..2e8ffe5 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | |||
@@ -72,11 +72,8 @@ namespace OpenSim.Services.AuthenticationService | |||
72 | { | 72 | { |
73 | realID = UUID.Zero; | 73 | realID = UUID.Zero; |
74 | 74 | ||
75 | m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}, user account service present: {1}", principalID, m_UserAccountService != null); | 75 | m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}", principalID); |
76 | AuthenticationData data = m_Database.Get(principalID); | 76 | AuthenticationData data = m_Database.Get(principalID); |
77 | UserAccount user = null; | ||
78 | if (m_UserAccountService != null) | ||
79 | user = m_UserAccountService.GetUserAccount(UUID.Zero, principalID); | ||
80 | 77 | ||
81 | if (data == null || data.Data == null) | 78 | if (data == null || data.Data == null) |
82 | { | 79 | { |
@@ -100,53 +97,7 @@ namespace OpenSim.Services.AuthenticationService | |||
100 | return GetToken(principalID, lifetime); | 97 | return GetToken(principalID, lifetime); |
101 | } | 98 | } |
102 | 99 | ||
103 | if (user == null) | 100 | m_log.DebugFormat("[AUTH SERVICE]: Authenticating FAIL for {0} ", principalID); |
104 | { | ||
105 | m_log.DebugFormat("[PASS AUTH]: No user record for {0}", principalID); | ||
106 | return String.Empty; | ||
107 | } | ||
108 | |||
109 | int impersonateFlag = 1 << 6; | ||
110 | |||
111 | if ((user.UserFlags & impersonateFlag) == 0) | ||
112 | return String.Empty; | ||
113 | |||
114 | m_log.DebugFormat("[PASS AUTH]: Attempting impersonation"); | ||
115 | |||
116 | List<UserAccount> accounts = m_UserAccountService.GetUserAccountsWhere(UUID.Zero, "UserLevel >= 200"); | ||
117 | if (accounts == null || accounts.Count == 0) | ||
118 | return String.Empty; | ||
119 | |||
120 | foreach (UserAccount a in accounts) | ||
121 | { | ||
122 | data = m_Database.Get(a.PrincipalID); | ||
123 | if (data == null || data.Data == null || | ||
124 | !data.Data.ContainsKey("passwordHash") || | ||
125 | !data.Data.ContainsKey("passwordSalt")) | ||
126 | { | ||
127 | continue; | ||
128 | } | ||
129 | |||
130 | // m_log.DebugFormat("[PASS AUTH]: Trying {0}", data.PrincipalID); | ||
131 | |||
132 | hashed = Util.Md5Hash(password + ":" + | ||
133 | data.Data["passwordSalt"].ToString()); | ||
134 | |||
135 | if (data.Data["passwordHash"].ToString() == hashed) | ||
136 | { | ||
137 | m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID); | ||
138 | realID = a.PrincipalID; | ||
139 | return GetToken(principalID, lifetime); | ||
140 | } | ||
141 | // else | ||
142 | // { | ||
143 | // m_log.DebugFormat( | ||
144 | // "[AUTH SERVICE]: Salted hash {0} of given password did not match salted hash of {1} for PrincipalID {2}. Authentication failure.", | ||
145 | // hashed, data.Data["passwordHash"], data.PrincipalID); | ||
146 | // } | ||
147 | } | ||
148 | |||
149 | m_log.DebugFormat("[PASS AUTH]: Impersonation of {0} failed", principalID); | ||
150 | return String.Empty; | 101 | return String.Empty; |
151 | } | 102 | } |
152 | } | 103 | } |