diff options
author | Kim Alvefur <zash@zash.se> | 2017-12-05 12:26:08 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-12-05 12:26:08 +0100 |
commit | 2c3887aa026cf8cab9f9bf7cd8a46185b6261696 (patch) | |
tree | 3f699a0df8571b1c9ba7410f82b611df191291ea /plugins/mod_dialback.lua | |
parent | d73bbfc4829d3bc7cc5c00dfcac47b98683f02d1 (diff) | |
parent | 5139d669fc8d8a2d25cdcbda9976031ed41ce644 (diff) | |
download | prosody-2c3887aa026cf8cab9f9bf7cd8a46185b6261696.tar.gz prosody-2c3887aa026cf8cab9f9bf7cd8a46185b6261696.zip |
Merge 0.10->trunk
Diffstat (limited to 'plugins/mod_dialback.lua')
-rw-r--r-- | plugins/mod_dialback.lua | 14 |
1 files changed, 13 insertions, 1 deletions
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 |