aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_tls.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-02-12 21:33:22 +0000
committerMatthew Wild <mwild1@gmail.com>2010-02-12 21:33:22 +0000
commitf7573ef4ffe462e42ee63b4e002987662da4b379 (patch)
treea3625d7c28784da11f27b1b3b38c6400e1cbafe6 /plugins/mod_tls.lua
parentfee6a443f9fd43ea4bbbb6f0e52cd39ec1974189 (diff)
downloadprosody-f7573ef4ffe462e42ee63b4e002987662da4b379.tar.gz
prosody-f7573ef4ffe462e42ee63b4e002987662da4b379.zip
mod_tls: Don't offer TLS on hosts that don't have any certs
Diffstat (limited to 'plugins/mod_tls.lua')
-rw-r--r--plugins/mod_tls.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua
index 47b92d73..3e3bd554 100644
--- a/plugins/mod_tls.lua
+++ b/plugins/mod_tls.lua
@@ -22,6 +22,8 @@ if secure_s2s_only then s2s_feature:tag("required"):up(); end
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 @@ end);
-- 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);