From 337c4dea6f1d78a527e8b46a3b152ac53792961c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 5 Dec 2017 11:12:58 +0100 Subject: mod_limits: Fix typo in comment --- plugins/mod_limits.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_limits.lua b/plugins/mod_limits.lua index 66341618..3fc3fcaa 100644 --- a/plugins/mod_limits.lua +++ b/plugins/mod_limits.lua @@ -1,4 +1,4 @@ --- Because we deal we pre-authed sessions and streams we can't be host-specific +-- Because we deal with pre-authed sessions and streams we can't be host-specific module:set_global(); local filters = require "util.filters"; -- cgit v1.2.3 From fd533f1aaedfef09ea27d981e865cc67946510c7 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 5 Dec 2017 12:21:51 +0100 Subject: mod_dialback: Copy function from mod_s2s instead of depending on it, which made it harder to disable s2s (fixes #1050) --- plugins/mod_dialback.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index f0fe949a..dcbf9448 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -14,7 +14,6 @@ local st = require "util.stanza"; local sha256_hash = require "util.hashes".sha256; local sha256_hmac = require "util.hashes".hmac_sha256; local nameprep = require "util.encodings".stringprep.nameprep; -local check_cert_status = module:depends"s2s".check_cert_status; local uuid_gen = require"util.uuid".generate; local xmlns_stream = "http://etherx.jabber.org/streams"; @@ -24,6 +23,19 @@ local dialback_requests = setmetatable({}, { __mode = 'v' }); local dialback_secret = sha256_hash(module:get_option_string("dialback_secret", uuid_gen()), true); local dwd = module:get_option_boolean("dialback_without_dialback", false); +--- Helper to check that a session peer's certificate is valid +function check_cert_status(session) + local host = session.direction == "outgoing" and session.to_host or session.from_host + local conn = session.conn:socket() + local cert + if conn.getpeercertificate then + cert = conn:getpeercertificate() + end + + return module:fire_event("s2s-check-certificate", { host = host, session = session, cert = cert }); +end + + function module.save() return { dialback_secret = dialback_secret }; end -- cgit v1.2.3