Software /
code /
prosody
Diff
util/sasl/digest-md5.lua @ 5301:6279caf921f1
util.sasl.{plain,scram,digest-md5}: nodeprep username before passing to callbacks, so callbacks don't have to.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 22 Jan 2013 08:21:05 +0500 |
parent | 4113:65482a852c4d |
child | 6777:5de6b93d0190 |
line wrap: on
line diff
--- a/util/sasl/digest-md5.lua Sat Jan 12 17:26:50 2013 +0100 +++ b/util/sasl/digest-md5.lua Tue Jan 22 08:21:05 2013 +0500 @@ -23,6 +23,7 @@ local md5 = require "util.hashes".md5; local log = require "util.logger".init("sasl"); local generate_uuid = require "util.uuid".generate; +local nodeprep = require "util.encodings".stringprep.nodeprep; module "sasl.digest-md5" @@ -139,10 +140,15 @@ end -- check for username, it's REQUIRED by RFC 2831 - if not response["username"] then + local username = response["username"]; + local _nodeprep = self.profile.nodeprep; + if username and _nodeprep ~= false then + username = (_nodeprep or nodeprep)(username); -- FIXME charset + end + if not username or username == "" then return "failure", "malformed-request"; end - self["username"] = response["username"]; + self.username = username; -- check for nonce, ... if not response["nonce"] then @@ -178,7 +184,6 @@ end --TODO maybe realm support - self.username = response["username"]; local Y, state; if self.profile.plain then local password, state = self.profile.plain(self, response["username"], self.realm)