Hi,

here are 3 patches fixing this ssdp bug: https://issues.prosody.im/1845

-tmolitor

-- 
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/prosody-dev/4712273.IvQSrhoTOX%40laptop.
# HG changeset patch
# User tmolitor <[email protected]>
# Date 1732075449 -3600
#      Wed Nov 20 05:04:09 2024 +0100
# Node ID d7fe9851a6f4b2df706a069a7e81f71b788ae817
# Parent  9277fc78fe39c9a326a6bc3779f5a14a706de43d
mod_saslauth: add usable sasl mechanisms to session table

This is needed to fix the SSDP bug described here:
https://issues.prosody.im/1845

diff -r 9277fc78fe39 -r d7fe9851a6f4 plugins/mod_saslauth.lua
--- a/plugins/mod_saslauth.lua	Tue Nov 19 00:57:24 2024 +0100
+++ b/plugins/mod_saslauth.lua	Wed Nov 20 05:04:09 2024 +0100
@@ -403,6 +403,7 @@
 			usable_mechanisms = usable_mechanisms - insecure_mechanisms;
 		end
 
+		origin.usable_mechanisms = usable_mechanisms;
 		if not usable_mechanisms:empty() then
 			log("debug", "Offering usable mechanisms: %s", usable_mechanisms);
 			for mechanism in usable_mechanisms do
# HG changeset patch
# User tmolitor <[email protected]>
# Date 1732075530 -3600
#      Wed Nov 20 05:05:30 2024 +0100
# Node ID 8da64ecdbcaa1501852f69257e04cc1633250489
# Parent  56fa3bad16cc967c07febd59dbb06b5d9a7334d3
mod_sasl2: add usable sasl mechanisms to session table

This is needed to fix the SSDP bug described here:
https://issues.prosody.im/1845

diff -r 56fa3bad16cc -r 8da64ecdbcaa mod_sasl2/mod_sasl2.lua
--- a/mod_sasl2/mod_sasl2.lua	Tue Nov 19 10:44:00 2024 +0100
+++ b/mod_sasl2/mod_sasl2.lua	Wed Nov 20 05:05:30 2024 +0100
@@ -86,6 +86,7 @@
 
 	local mechanisms = st.stanza("authentication", { xmlns = xmlns_sasl2 });
 
+	origin.usable_mechanisms = set.new();
 	local available_mechanisms = sasl_handler:mechanisms()
 	for mechanism in pairs(available_mechanisms) do
 		if disabled_mechanisms:contains(mechanism) then
@@ -95,6 +96,7 @@
 		else
 			log("debug", "Offering mechanism %s", mechanism);
 			mechanisms:text_tag("mechanism", mechanism);
+			origin.usable_mechanisms:add(mechanism);
 		end
 	end
 
# HG changeset patch
# User tmolitor <[email protected]>
# Date 1732075631 -3600
#      Wed Nov 20 05:07:11 2024 +0100
# Node ID ad23defb5616fa9e04ffae5b3ecfe8ded24703b9
# Parent  8da64ecdbcaa1501852f69257e04cc1633250489
mod_sasl_ssdp: Fix handling of disabled sasl mechanisms

This fixes this bug: https://issues.prosody.im/1845

diff -r 8da64ecdbcaa -r ad23defb5616 mod_sasl_ssdp/mod_sasl_ssdp.lua
--- a/mod_sasl_ssdp/mod_sasl_ssdp.lua	Wed Nov 20 05:05:30 2024 +0100
+++ b/mod_sasl_ssdp/mod_sasl_ssdp.lua	Wed Nov 20 05:07:11 2024 +0100
@@ -17,7 +17,11 @@
 		module:log("debug", "Not enabling SSDP for unsupported mechanism: %s", sasl_handler.selected);
 		return;
 	end
-	local mechanism_list = array.collect(it.keys(sasl_handler:mechanisms())):sort();
+	if not event.session.usable_mechanisms then
+		module:log("info", "Not enabling SSDP: Prosody version too old to support SSDP!");
+		return;
+	end
+	local mechanism_list = array.collect(event.session.usable_mechanisms):sort();
 	local cb = sasl_handler.profile.cb;
 	local cb_list = cb and array.collect(it.keys(cb)):sort();
 	local ssdp_string;

Reply via email to