Changeset

2623:1d34b45dec15

mod_tls: Don't offer TLS on hosts that don't have any certs
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Feb 2010 21:33:22 +0000
parents 2622:5ced53147f86
children 2624:99b60dc15174
files plugins/mod_tls.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_tls.lua	Fri Feb 12 17:27:53 2010 +0000
+++ b/plugins/mod_tls.lua	Fri Feb 12 21:33:22 2010 +0000
@@ -22,6 +22,8 @@
 
 local global_ssl_ctx = prosody.global_ssl_ctx;
 
+local host = hosts[module.host];
+
 -- Hook <starttls/>
 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event)
 	local origin = event.origin;
@@ -44,13 +46,13 @@
 -- Advertize stream feature
 module:hook("stream-features", function(event)
 	local origin, features = event.origin, event.features;
-	if not origin.username and origin.conn.starttls then
+	if not origin.username and origin.conn.starttls and host.ssl_ctx_in then
 		features:add_child(c2s_feature);
 	end
 end);
 module:hook("s2s-stream-features", function(event)
 	local origin, features = event.origin, event.features;
-	if origin.to_host and origin.type ~= "s2sin" and origin.conn.starttls then
+	if origin.to_host and origin.type ~= "s2sin" and origin.conn.starttls and host.ssl_ctx_in then
 		features:add_child(s2s_feature);
 	end
 end);