Mercurial > prosody-hg
comparison plugins/mod_auth_internal_hashed.lua @ 5776:bd0ff8ae98a8
Remove all trailing whitespace
| author | Florian Zeitz <florob@babelmonkeys.de> |
|---|---|
| date | Fri, 09 Aug 2013 17:48:21 +0200 |
| parents | eeea0eb2602a |
| children | f449da907b85 |
comparison
equal
deleted
inserted
replaced
| 5775:a6c2b8933507 | 5776:bd0ff8ae98a8 |
|---|---|
| 60 end | 60 end |
| 61 | 61 |
| 62 if credentials.iteration_count == nil or credentials.salt == nil or string.len(credentials.salt) == 0 then | 62 if credentials.iteration_count == nil or credentials.salt == nil or string.len(credentials.salt) == 0 then |
| 63 return nil, "Auth failed. Stored salt and iteration count information is not complete."; | 63 return nil, "Auth failed. Stored salt and iteration count information is not complete."; |
| 64 end | 64 end |
| 65 | 65 |
| 66 local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, credentials.salt, credentials.iteration_count); | 66 local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, credentials.salt, credentials.iteration_count); |
| 67 | 67 |
| 68 local stored_key_hex = to_hex(stored_key); | 68 local stored_key_hex = to_hex(stored_key); |
| 69 local server_key_hex = to_hex(server_key); | 69 local server_key_hex = to_hex(server_key); |
| 70 | 70 |
| 71 if valid and stored_key_hex == credentials.stored_key and server_key_hex == credentials.server_key then | 71 if valid and stored_key_hex == credentials.stored_key and server_key_hex == credentials.server_key then |
| 72 return true; | 72 return true; |
| 73 else | 73 else |
| 74 return nil, "Auth failed. Invalid username, password, or password hash information."; | 74 return nil, "Auth failed. Invalid username, password, or password hash information."; |
| 75 end | 75 end |
| 81 account.salt = account.salt or generate_uuid(); | 81 account.salt = account.salt or generate_uuid(); |
| 82 account.iteration_count = account.iteration_count or iteration_count; | 82 account.iteration_count = account.iteration_count or iteration_count; |
| 83 local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, account.salt, account.iteration_count); | 83 local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, account.salt, account.iteration_count); |
| 84 local stored_key_hex = to_hex(stored_key); | 84 local stored_key_hex = to_hex(stored_key); |
| 85 local server_key_hex = to_hex(server_key); | 85 local server_key_hex = to_hex(server_key); |
| 86 | 86 |
| 87 account.stored_key = stored_key_hex | 87 account.stored_key = stored_key_hex |
| 88 account.server_key = server_key_hex | 88 account.server_key = server_key_hex |
| 89 | 89 |
| 90 account.password = nil; | 90 account.password = nil; |
| 91 return accounts:set(username, account); | 91 return accounts:set(username, account); |
| 132 if credentials.password then | 132 if credentials.password then |
| 133 usermanager.set_password(username, credentials.password, host); | 133 usermanager.set_password(username, credentials.password, host); |
| 134 credentials = accounts:get(username); | 134 credentials = accounts:get(username); |
| 135 if not credentials then return; end | 135 if not credentials then return; end |
| 136 end | 136 end |
| 137 | 137 |
| 138 local stored_key, server_key, iteration_count, salt = credentials.stored_key, credentials.server_key, credentials.iteration_count, credentials.salt; | 138 local stored_key, server_key, iteration_count, salt = credentials.stored_key, credentials.server_key, credentials.iteration_count, credentials.salt; |
| 139 stored_key = stored_key and from_hex(stored_key); | 139 stored_key = stored_key and from_hex(stored_key); |
| 140 server_key = server_key and from_hex(server_key); | 140 server_key = server_key and from_hex(server_key); |
| 141 return stored_key, server_key, iteration_count, salt, true; | 141 return stored_key, server_key, iteration_count, salt, true; |
| 142 end | 142 end |
| 143 }; | 143 }; |
| 144 return new_sasl(host, testpass_authentication_profile); | 144 return new_sasl(host, testpass_authentication_profile); |
| 145 end | 145 end |
| 146 | 146 |
| 147 module:provides("auth", provider); | 147 module:provides("auth", provider); |
| 148 | 148 |
