Automated merge with http://waqas.ath.cx/
authorMatthew Wild <mwild1@gmail.com>
Wed, 3 Dec 2008 17:24:20 +0000 (17:24 +0000)
committerMatthew Wild <mwild1@gmail.com>
Wed, 3 Dec 2008 17:24:20 +0000 (17:24 +0000)
plugins/mod_saslauth.lua
util/sasl.lua

index 7cb93c462524627c4004297cc1f46fa0e9e1bcc6..52ef68c7eb26f95620e83e3d39b847bcc8dde5ec 100644 (file)
@@ -64,14 +64,14 @@ local function handle_status(session, status)
        end
 end
 
-local function password_callback(node, host, mechanism)
+local function password_callback(node, host, mechanism, raw_host)
        local password = (datamanager.load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords
        local func = function(x) return x; end;
        if password then
                if mechanism == "PLAIN" then
                        return func, password;
                elseif mechanism == "DIGEST-MD5" then
-                       return func, md5(node..":"..host..":"..password);
+                       return func, md5(node..":"..raw_host..":"..password);
                end
        end
        return func, nil;
index 7983a3c21dd58e88e4116533e54578813b245df9..ab8b814b10268fbe1874fe20ef8f75a13c5d251c 100644 (file)
@@ -144,6 +144,7 @@ local function new_digest_md5(realm, password_handler)
                        if not response["qop"] then response["qop"] = "auth" end
                        
                        if response["realm"] == nil then response["realm"] = "" end
+                       local raw_realm = response["realm"];
                        
                        if response["charset"] == nil then
                                response["username"] = latin1toutf8(response["username"])
@@ -163,7 +164,7 @@ local function new_digest_md5(realm, password_handler)
                        
                        --TODO maybe realm support
                        self.username = response["username"]
-                       local password_encoding, Y = self.password_handler(response["username"], response["realm"], "DIGEST-MD5")
+                       local password_encoding, Y = self.password_handler(response["username"], response["realm"], "DIGEST-MD5", raw_realm)
                        if Y == nil then return "failure", "not-authorized"
                        elseif Y == false then return "failure", "account-disabled" end