Diff

plugins/mod_saslauth.lua @ 4504:55b61221ecb8

mod_saslauth: Move authentication-success event to after session has been made authenticated.
author Kim Alvefur <zash@zash.se>
date Sun, 12 Feb 2012 15:05:31 +0100
parent 4492:0a4781f165e3
child 4505:b1e10c327d66
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Sat Feb 11 14:51:00 2012 +0000
+++ b/plugins/mod_saslauth.lua	Sun Feb 12 15:05:31 2012 +0100
@@ -51,11 +51,11 @@
 		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