plugins/mod_saslauth.lua

changeset 1721
1dcfb2c64302
parent 1523
841d61be198f
child 1725
fb3137652ea6
child 1846
fdb43fc1bafc
--- a/plugins/mod_saslauth.lua	Wed Aug 19 21:34:28 2009 +0200
+++ b/plugins/mod_saslauth.lua	Wed Aug 19 21:59:16 2009 +0200
@@ -12,7 +12,7 @@
 local sm_bind_resource = require "core.sessionmanager".bind_resource;
 local sm_make_authenticated = require "core.sessionmanager".make_authenticated;
 local base64 = require "util.encodings".base64;
-
+local nodeprep = require "util.encodings".stringprep.nodeprep;
 local datamanager_load = require "util.datamanager".load;
 local usermanager_validate_credentials = require "core.usermanager".validate_credentials;
 local t_concat, t_insert = table.concat, table.insert;
@@ -65,8 +65,12 @@
 end
 
 local function password_callback(node, hostname, realm, mechanism, decoder)
+	local func = function(x) return x; end;
+	local node = nodeprep(node);
+	if not node then
+		return func, nil;
+	end
 	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;

mercurial