Diff

plugins/mod_tls.lua @ 2853:91143b35a755

mod_tls: Respond with proper error when TLS cannot be negotiated.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 12 Feb 2010 02:39:50 +0500
parent 1981:ffbc57a4dea8
child 2854:ce8ce431c2b8
line wrap: on
line diff
--- a/plugins/mod_tls.lua	Fri Feb 12 00:55:06 2010 +0500
+++ b/plugins/mod_tls.lua	Fri Feb 12 02:39:50 2010 +0500
@@ -26,8 +26,9 @@
 				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 @@
 				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);