Diff

plugins/mod_saslauth.lua @ 1721:1dcfb2c64302

Use NODEprep for prepping usernames used during SASL logins.
author Tobias Markmann <tm@ayena.de>
date Wed, 19 Aug 2009 21:59:16 +0200
parent 1523:841d61be198f
child 1725:fb3137652ea6
child 1846:fdb43fc1bafc
line wrap: on
line diff
--- 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;