aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-12-08 03:23:37 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-12-08 03:23:37 +0500
commit5b3c2cf16701c9bfa60c3fc5b54388e68dc8265a (patch)
treef09f7fd42f79fa1eed44110848185d854e9a5879 /util
parentf7596f63cf106662abc2936454e839ee20fb7dca (diff)
downloadprosody-5b3c2cf16701c9bfa60c3fc5b54388e68dc8265a.tar.gz
prosody-5b3c2cf16701c9bfa60c3fc5b54388e68dc8265a.zip
Return error when the given realm value does not match the sent realm value. Prevents impersonation of an account on one virtual host, but a user with the same username on another host.
Diffstat (limited to 'util')
-rw-r--r--util/sasl.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/sasl.lua b/util/sasl.lua
index 89980eb2..12e7df4f 100644
--- a/util/sasl.lua
+++ b/util/sasl.lua
@@ -176,7 +176,11 @@ local function new_digest_md5(realm, password_handler)
if not response["cnonce"] then return "failure", "malformed-request", "Missing entry for cnonce in SASL message." end
if not response["qop"] then response["qop"] = "auth" end
- if response["realm"] == nil then response["realm"] = "" end
+ if response["realm"] == nil then
+ response["realm"] = ""
+ elseif response["realm"] ~= self.realm then
+ return "failure", "not-authorized", "Incorrect realm value";
+ end
local decoder;
if response["charset"] == nil then