Changeset

4507:32177c680d2a

Merge with 0.9
author Matthew Wild <mwild1@gmail.com>
date Sun, 12 Feb 2012 14:21:09 +0000
parents 4503:6dc327809dfd (current diff) 4506:6643c9753453 (diff)
children 4509:e886bd7c2f6c
files
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Sat Feb 11 14:51:29 2012 +0000
+++ b/plugins/mod_saslauth.lua	Sun Feb 12 14:21:09 2012 +0000
@@ -16,7 +16,6 @@
 
 local cert_verify_identity = require "util.x509".verify_identity;
 
-local nodeprep = require "util.encodings".stringprep.nodeprep;
 local usermanager_get_sasl_handler = require "core.usermanager".get_sasl_handler;
 local tostring = tostring;
 
@@ -51,15 +50,14 @@
 		module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg });
 		session.sasl_handler = session.sasl_handler:clean_clone();
 	elseif status == "success" then
-		module:fire_event("authentication-success", { session = session });
-		local username = nodeprep(session.sasl_handler.username);
-
 		local ok, err = sm_make_authenticated(session, session.sasl_handler.username);
 		if ok then
+			module:fire_event("authentication-success", { session = session });
 			session.sasl_handler = nil;
 			session:reset_stream();
 		else
 			module:log("warn", "SASL succeeded but username was invalid");
+			module:fire_event("authentication-failure", { session = session, condition = "not-authorized", text = err });
 			session.sasl_handler = session.sasl_handler:clean_clone();
 			return "failure", "not-authorized", "User authenticated successfully, but username was invalid";
 		end