aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl/plain.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2013-01-22 08:21:05 +0500
committerWaqas Hussain <waqas20@gmail.com>2013-01-22 08:21:05 +0500
commit467bf52500181cb6da64f18f7a5a827c24bb66d5 (patch)
treef10ba62ad7fbaef94033ed95e2eec8c934edd993 /util/sasl/plain.lua
parent1931de09249a06487cd72bd086eab8d32b48a3e9 (diff)
downloadprosody-467bf52500181cb6da64f18f7a5a827c24bb66d5.tar.gz
prosody-467bf52500181cb6da64f18f7a5a827c24bb66d5.zip
util.sasl.{plain,scram,digest-md5}: nodeprep username before passing to callbacks, so callbacks don't have to.
Diffstat (limited to 'util/sasl/plain.lua')
-rw-r--r--util/sasl/plain.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/util/sasl/plain.lua b/util/sasl/plain.lua
index d108a40d..c9ec2911 100644
--- a/util/sasl/plain.lua
+++ b/util/sasl/plain.lua
@@ -13,6 +13,7 @@
local s_match = string.match;
local saslprep = require "util.encodings".stringprep.saslprep;
+local nodeprep = require "util.encodings".stringprep.nodeprep;
local log = require "util.logger".init("sasl");
module "sasl.plain"
@@ -54,6 +55,14 @@ local function plain(self, message)
return "failure", "malformed-request", "Invalid username or password.";
end
+ local _nodeprep = self.profile.nodeprep;
+ if _nodeprep ~= false then
+ authentication = (_nodeprep or nodeprep)(authentication);
+ if not authentication or authentication == "" then
+ return "failure", "malformed-request", "Invalid username or password."
+ end
+ end
+
local correct, state = false, false;
if self.profile.plain then
local correct_password;