# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1663861685 -3600
# Node ID 3697d19d5fd92a1a263c4f7ca1543bae4d438ac3
# Parent  023f21bfcc08d267ea119b0c4d2dc0bfb70e66c0
mod_sasl2: Store client id if provided

diff -r 023f21bfcc08 -r 3697d19d5fd9 mod_sasl2/mod_sasl2.lua
--- a/mod_sasl2/mod_sasl2.lua	Thu Sep 22 16:43:51 2022 +0100
+++ b/mod_sasl2/mod_sasl2.lua	Thu Sep 22 16:48:05 2022 +0100
@@ -191,6 +191,10 @@
 	if not sasl_handler:select(mechanism) then
 		return handle_status(session, "failure", "invalid-mechanism");
 	end
+	local user_agent = auth:get_child("user-agent");
+	if user_agent then
+		session.client_id = user_agent.attr.id;
+	end
 	local initial = auth:get_child_text("initial-response");
 	return process_cdata(session, initial);
 end);