Diff

plugins/mod_saslauth.lua @ 1375:50ee4b327f86

Adding a parameter for realm to the password_callback.
author Tobias Markmann <tm@ayena.de>
date Sat, 20 Jun 2009 19:34:30 +0200
parent 1217:844ef764ef0e
child 1449:6a90316a81c3
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Sat Jun 20 19:06:04 2009 +0200
+++ b/plugins/mod_saslauth.lua	Sat Jun 20 19:34:30 2009 +0200
@@ -64,15 +64,15 @@
 	end
 end
 
-local function password_callback(node, host, mechanism, decoder)
-	local password = (datamanager_load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords
+local function password_callback(node, hostname, realm, mechanism, decoder)
+	local password = (datamanager_load(node, hostname, "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
-			if decoder then node, host, password = decoder(node), decoder(host), decoder(password); end
-			return func, md5(node..":"..host..":"..password);
+			if decoder then node, hostname, password = decoder(node), decoder(hostname), decoder(password); end
+			return func, md5(node..":"..realm..":"..password);
 		end
 	end
 	return func, nil;