Comparison

mod_sasl2/mod_sasl2.lua @ 6136:8da64ecdbcaa

mod_sasl2: add usable sasl mechanisms to session table This is needed to fix the SSDP bug described here: https://issues.prosody.im/1845
author tmolitor <thilo@eightysoft.de>
date Wed, 20 Nov 2024 05:05:30 +0100
parent 6056:56fa3bad16cc
child 6139:ce755c661036
comparison
equal deleted inserted replaced
6056:56fa3bad16cc 6136:8da64ecdbcaa
84 end 84 end
85 end 85 end
86 86
87 local mechanisms = st.stanza("authentication", { xmlns = xmlns_sasl2 }); 87 local mechanisms = st.stanza("authentication", { xmlns = xmlns_sasl2 });
88 88
89 origin.usable_mechanisms = set.new();
89 local available_mechanisms = sasl_handler:mechanisms() 90 local available_mechanisms = sasl_handler:mechanisms()
90 for mechanism in pairs(available_mechanisms) do 91 for mechanism in pairs(available_mechanisms) do
91 if disabled_mechanisms:contains(mechanism) then 92 if disabled_mechanisms:contains(mechanism) then
92 log("debug", "Not offering disabled mechanism %s", mechanism); 93 log("debug", "Not offering disabled mechanism %s", mechanism);
93 elseif not origin.secure and insecure_mechanisms:contains(mechanism) then 94 elseif not origin.secure and insecure_mechanisms:contains(mechanism) then
94 log("debug", "Not offering mechanism %s on insecure connection", mechanism); 95 log("debug", "Not offering mechanism %s on insecure connection", mechanism);
95 else 96 else
96 log("debug", "Offering mechanism %s", mechanism); 97 log("debug", "Offering mechanism %s", mechanism);
97 mechanisms:text_tag("mechanism", mechanism); 98 mechanisms:text_tag("mechanism", mechanism);
99 origin.usable_mechanisms:add(mechanism);
98 end 100 end
99 end 101 end
100 102
101 features:add_direct_child(mechanisms); 103 features:add_direct_child(mechanisms);
102 104