aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_tls.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_tls.lua')
-rw-r--r--plugins/mod_tls.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua
index a97f7027..f62032b6 100644
--- a/plugins/mod_tls.lua
+++ b/plugins/mod_tls.lua
@@ -79,7 +79,7 @@ end
module:hook_global("config-reloaded", module.load);
local function can_do_tls(session)
- if not session.conn.starttls then
+ if session.conn and not session.conn.starttls then
if not session.secure then
session.log("debug", "Underlying connection does not support STARTTLS");
end
@@ -116,6 +116,11 @@ local function can_do_tls(session)
return session.ssl_ctx;
end
+module:hook("s2sout-created", function (event)
+ -- Initialize TLS context for outgoing connections
+ can_do_tls(event.session);
+end);
+
-- Hook <starttls/>
module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event)
local origin = event.origin;