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
commitc0d4c641f38d6232df69ee902b3dcf4ae145bc15 (patch)
treef10ba62ad7fbaef94033ed95e2eec8c934edd993 /util/sasl/plain.lua
parent2eddb12845d284554677ac9bfb79edf545f32a74 (diff)
downloadprosody-c0d4c641f38d6232df69ee902b3dcf4ae145bc15.tar.gz
prosody-c0d4c641f38d6232df69ee902b3dcf4ae145bc15.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;