aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-08-10 20:51:31 +0200
committerKim Alvefur <zash@zash.se>2021-08-10 20:51:31 +0200
commitc3047df95ac25968d24e9bb4650c8ebac982bb22 (patch)
treeed7ecdf9c3045adca17ca3dfbc341c068680a92c /plugins
parente7df432614fc16a06f75c3e038176820f92a320d (diff)
downloadprosody-c3047df95ac25968d24e9bb4650c8ebac982bb22.tar.gz
prosody-c3047df95ac25968d24e9bb4650c8ebac982bb22.zip
mod_s2s: Factor out procedure for newly encrypted sessions
Goal is to call this if the connection is using Direct TLS, either via multiplexing or a future Direct TLS S2S port.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_s2s.lua28
1 files changed, 16 insertions, 12 deletions
diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua
index cc935d21..df9e4dd9 100644
--- a/plugins/mod_s2s.lua
+++ b/plugins/mod_s2s.lua
@@ -379,6 +379,21 @@ end
--- XMPP stream event handlers
+local function session_secure(session)
+ session.secure = true;
+ session.encrypted = true;
+
+ local sock = session.conn:socket();
+ local info = sock.info and sock:info();
+ if type(info) == "table" then
+ (session.log or log)("info", "Stream encrypted (%s with %s)", info.protocol, info.cipher);
+ session.compressed = info.compression;
+ m_tls_params:with_labels(info.protocol, info.cipher):add(1)
+ else
+ (session.log or log)("info", "Stream encrypted");
+ end
+end
+
local stream_callbacks = { default_ns = "jabber:server" };
function stream_callbacks.handlestanza(session, stanza)
@@ -399,18 +414,7 @@ function stream_callbacks._streamopened(session, attr)
-- TODO: Rename session.secure to session.encrypted
if session.secure == false then
- session.secure = true;
- session.encrypted = true;
-
- local sock = session.conn:socket();
- local info = sock.info and sock:info();
- if type(info) == "table" then
- (session.log or log)("info", "Stream encrypted (%s with %s)", info.protocol, info.cipher);
- session.compressed = info.compression;
- m_tls_params:with_labels(info.protocol, info.cipher):add(1)
- else
- (session.log or log)("info", "Stream encrypted");
- end
+ session_secure(session);
end
if session.direction == "incoming" then