diff mod_sasl2/mod_sasl2.lua @ 5650:0eb2d5ea2428

merge
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Sat, 06 May 2023 19:40:23 -0500
parents 6526b670e66d
children 2597e2113561
line wrap: on
line diff
--- a/mod_sasl2/mod_sasl2.lua	Wed Feb 22 22:47:45 2023 -0500
+++ b/mod_sasl2/mod_sasl2.lua	Sat May 06 19:40:23 2023 -0500
@@ -121,6 +121,7 @@
 end
 
 module:hook("sasl2/c2s/failure", function (event)
+	module:fire_event("authentication-failure", event);
 	local session, condition, text = event.session, event.message, event.error_text;
 	local failure = st.stanza("failure", { xmlns = xmlns_sasl2 })
 		:tag(condition, { xmlns = "urn:ietf:params:xml:ns:xmpp-sasl" }):up();
@@ -165,6 +166,7 @@
 end, -1000);
 
 module:hook("sasl2/c2s/success", function (event)
+	module:fire_event("authentication-success", event);
 	local session = event.session;
 	local features = st.stanza("stream:features");
 	module:fire_event("stream-features", { origin = session, features = features });
@@ -206,6 +208,10 @@
 	local user_agent = auth:get_child("user-agent");
 	if user_agent then
 		session.client_id = user_agent.attr.id;
+		sasl_handler.user_agent = {
+			software = user_agent:get_child_text("software");
+			device = user_agent:get_child_text("device");
+		};
 	end
 	local initial = auth:get_child_text("initial-response");
 	return process_cdata(session, initial);