Comparison

mod_tlsfail/mod_tlsfail.lua @ 4434:f10ab82be166

mod_tlsfail: Test how servers react to starttls failure Lines copypasted from mod_tls Intended for use in the badxmpp.eu test suite
author Kim Alvefur <zash@zash.se>
date Wed, 10 Feb 2021 16:02:28 +0100
child 4702:7009e16192fa
comparison
equal deleted inserted replaced
4433:0e3f5f70a51d 4434:f10ab82be166
1 local st = require "util.stanza";
2
3 local xmlns_starttls = 'urn:ietf:params:xml:ns:xmpp-tls';
4 local starttls_attr = { xmlns = xmlns_starttls };
5 local s2s_feature = st.stanza("starttls", starttls_attr);
6 local starttls_failure = st.stanza("failure", starttls_attr);
7
8 module:hook("s2s-stream-features", function(event)
9 local features = event.features;
10 features:add_child(s2s_feature);
11 end);
12
13 -- Hook <starttls/>
14 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event)
15 local origin = event.origin;
16 origin.sends2s(starttls_failure);
17 origin:close();
18 return true;
19 end);