aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_auth_internal_hashed.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-06 00:54:28 +0200
committerKim Alvefur <zash@zash.se>2020-06-06 00:54:28 +0200
commitbcb73345a91c30fe9979c557e7cae2870dc97c08 (patch)
tree5dab399947091600ef0a5f4937cd915844ad6584 /plugins/mod_auth_internal_hashed.lua
parent90ae8d8e1d3fc0ba58c24501b0a39b2c999233a0 (diff)
parent3ce91067f6299da1d8d9b4c8a1fdbf304cf91914 (diff)
downloadprosody-bcb73345a91c30fe9979c557e7cae2870dc97c08.tar.gz
prosody-bcb73345a91c30fe9979c557e7cae2870dc97c08.zip
Merge 0.11->trunk
Diffstat (limited to 'plugins/mod_auth_internal_hashed.lua')
-rw-r--r--plugins/mod_auth_internal_hashed.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/mod_auth_internal_hashed.lua b/plugins/mod_auth_internal_hashed.lua
index c81830de..4fd0bd13 100644
--- a/plugins/mod_auth_internal_hashed.lua
+++ b/plugins/mod_auth_internal_hashed.lua
@@ -15,6 +15,7 @@ local generate_uuid = require "util.uuid".generate;
local new_sasl = require "util.sasl".new;
local hex = require"util.hex";
local to_hex, from_hex = hex.to, hex.from;
+local saslprep = require "util.encodings".stringprep.saslprep;
local log = module._log;
local host = module.host;
@@ -34,9 +35,13 @@ local provider = {};
function provider.test_password(username, password)
log("debug", "test password for user '%s'", username);
local credentials = accounts:get(username) or {};
+ password = saslprep(password);
+ if not password then
+ return nil, "Password fails SASLprep.";
+ end
if credentials.password ~= nil and string.len(credentials.password) ~= 0 then
- if credentials.password ~= password then
+ if saslprep(credentials.password) ~= password then
return nil, "Auth failed. Provided password is incorrect.";
end