# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1254250471 -3600
# Node ID fdb43fc1bafc16ed7d2054bcccffded94bf4055e
# Parent  a4a8fe2a560c0bdce269e51e45c5d33d5adc7306
mod_saslauth: Prep username used for authenticating a session

diff -r a4a8fe2a560c -r fdb43fc1bafc plugins/mod_saslauth.lua
--- a/plugins/mod_saslauth.lua	Tue Sep 29 19:05:32 2009 +0100
+++ b/plugins/mod_saslauth.lua	Tue Sep 29 19:54:31 2009 +0100
@@ -52,14 +52,14 @@
 	if status == "failure" then
 		session.sasl_handler = nil;
 	elseif status == "success" then
-		if not session.sasl_handler.username then -- TODO move this to sessionmanager
+		local username = nodeprep(session.sasl_handler.username);
+		session.sasl_handler = nil;
+		if not username then -- TODO move this to sessionmanager
 			module:log("warn", "SASL succeeded but we didn't get a username!");
-			session.sasl_handler = nil;
 			session:reset_stream();
 			return;
 		end 
-		sm_make_authenticated(session, session.sasl_handler.username);
-		session.sasl_handler = nil;
+		sm_make_authenticated(session, username);
 		session:reset_stream();
 	end
 end