From 2e726abc77cdfb09f01eb31358ad56d587a9c88e Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 12 Feb 2010 02:39:50 +0500 Subject: mod_tls: Respond with proper error when TLS cannot be negotiated. --- plugins/mod_tls.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins/mod_tls.lua') diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua index 8a450803..fb1433da 100644 --- a/plugins/mod_tls.lua +++ b/plugins/mod_tls.lua @@ -26,8 +26,9 @@ module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, session.log("info", "TLS negotiation started..."); session.secure = false; else - -- FIXME: What reply? session.log("warn", "Attempt to start TLS, but TLS is not available on this connection"); + (session.sends2s or session.send)(st.stanza("failure", { xmlns = xmlns_starttls })); + session:close(); end end); @@ -43,8 +44,9 @@ module:add_handler("s2sin_unauthed", "starttls", xmlns_starttls, session.log("info", "TLS negotiation started for incoming s2s..."); session.secure = false; else - -- FIXME: What reply? session.log("warn", "Attempt to start TLS, but TLS is not available on this s2s connection"); + (session.sends2s or session.send)(st.stanza("failure", { xmlns = xmlns_starttls })); + session:close(); end end); -- cgit v1.2.3