Mercurial > prosody-hg
comparison plugins/mod_auth_internal_hashed.lua @ 5302:52fe5df91c65
mod_auth_internal_plain, mod_auth_internal_hashed: No need to nodeprep here.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Tue, 22 Jan 2013 08:26:08 +0500 |
| parents | 6b08c922a2e4 |
| children | eeea0eb2602a |
comparison
equal
deleted
inserted
replaced
| 5301:6279caf921f1 | 5302:52fe5df91c65 |
|---|---|
| 11 local log = require "util.logger".init("auth_internal_hashed"); | 11 local log = require "util.logger".init("auth_internal_hashed"); |
| 12 local getAuthenticationDatabaseSHA1 = require "util.sasl.scram".getAuthenticationDatabaseSHA1; | 12 local getAuthenticationDatabaseSHA1 = require "util.sasl.scram".getAuthenticationDatabaseSHA1; |
| 13 local usermanager = require "core.usermanager"; | 13 local usermanager = require "core.usermanager"; |
| 14 local generate_uuid = require "util.uuid".generate; | 14 local generate_uuid = require "util.uuid".generate; |
| 15 local new_sasl = require "util.sasl".new; | 15 local new_sasl = require "util.sasl".new; |
| 16 local nodeprep = require "util.encodings".stringprep.nodeprep; | |
| 17 | 16 |
| 18 local to_hex; | 17 local to_hex; |
| 19 do | 18 do |
| 20 local function replace_byte_with_hex(byte) | 19 local function replace_byte_with_hex(byte) |
| 21 return ("%02x"):format(byte:byte()); | 20 return ("%02x"):format(byte:byte()); |
| 122 end | 121 end |
| 123 | 122 |
| 124 function provider.get_sasl_handler() | 123 function provider.get_sasl_handler() |
| 125 local testpass_authentication_profile = { | 124 local testpass_authentication_profile = { |
| 126 plain_test = function(sasl, username, password, realm) | 125 plain_test = function(sasl, username, password, realm) |
| 127 local prepped_username = nodeprep(username); | 126 return usermanager.test_password(username, realm, password), true; |
| 128 if not prepped_username then | |
| 129 log("debug", "NODEprep failed on username: %s", username); | |
| 130 return "", nil; | |
| 131 end | |
| 132 return usermanager.test_password(prepped_username, realm, password), true; | |
| 133 end, | 127 end, |
| 134 scram_sha_1 = function(sasl, username, realm) | 128 scram_sha_1 = function(sasl, username, realm) |
| 135 local credentials = datamanager.load(username, host, "accounts"); | 129 local credentials = datamanager.load(username, host, "accounts"); |
| 136 if not credentials then return; end | 130 if not credentials then return; end |
| 137 if credentials.password then | 131 if credentials.password then |
