Use NODEprep for prepping usernames used during SASL logins.

Wed, 19 Aug 2009 21:59:16 +0200

author
Tobias Markmann <tm@ayena.de>
date
Wed, 19 Aug 2009 21:59:16 +0200
changeset 1721
1dcfb2c64302
parent 1720
c34409a5fdee
child 1722
132c41aa0680

Use NODEprep for prepping usernames used during SASL logins.

plugins/mod_saslauth.lua file | annotate | diff | comparison | revisions
--- 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