annotate mod_tlsfail/mod_tlsfail.lua @ 5927:07f32bf41303

mod_register_apps: Update Conversations Android version Source: - https://codeberg.org/iNPUTmice/Conversations/src/commit/4eee26e7d381f59a4402db30abbc640efeaf3980/build.gradle#L105 - https://apilevels.com/ Noticed thanks to https://mastodon.sdf.org/@itokoi/112745327733761311
author Kim Alvefur <zash@zash.se>
date Mon, 08 Jul 2024 10:47:07 +0200
parents 7009e16192fa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4434
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 local st = require "util.stanza";
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 local xmlns_starttls = 'urn:ietf:params:xml:ns:xmpp-tls';
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 local starttls_attr = { xmlns = xmlns_starttls };
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 local s2s_feature = st.stanza("starttls", starttls_attr);
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 local starttls_failure = st.stanza("failure", starttls_attr);
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7
4702
7009e16192fa mod_tlsfail: Add c2s support
Kim Alvefur <zash@zash.se>
parents: 4434
diff changeset
8 module:hook("stream-features", function(event)
7009e16192fa mod_tlsfail: Add c2s support
Kim Alvefur <zash@zash.se>
parents: 4434
diff changeset
9 local features = event.features;
7009e16192fa mod_tlsfail: Add c2s support
Kim Alvefur <zash@zash.se>
parents: 4434
diff changeset
10 features:add_child(s2s_feature);
7009e16192fa mod_tlsfail: Add c2s support
Kim Alvefur <zash@zash.se>
parents: 4434
diff changeset
11 end);
7009e16192fa mod_tlsfail: Add c2s support
Kim Alvefur <zash@zash.se>
parents: 4434
diff changeset
12
4434
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 module:hook("s2s-stream-features", function(event)
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 local features = event.features;
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 features:add_child(s2s_feature);
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 end);
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 -- Hook <starttls/>
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event)
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 local origin = event.origin;
4702
7009e16192fa mod_tlsfail: Add c2s support
Kim Alvefur <zash@zash.se>
parents: 4434
diff changeset
21 (origin.sends2s or origin.send)(starttls_failure);
4434
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 origin:close();
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23 return true;
f10ab82be166 mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 end);