Mercurial > prosody-modules
comparison mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua @ 531:2b71ba2739e0
mod_s2s_never_encrypt_blacklist: stick to one code "punctuation" style.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Sat, 07 Jan 2012 18:12:38 +0000 |
parents | 8fe1b47c9bde |
children | ef859c9d42c4 |
comparison
equal
deleted
inserted
replaced
530:3cc17ef98be0 | 531:2b71ba2739e0 |
---|---|
1 -- Filter out servers which gets choppy and buggy when it comes to starttls. | 1 -- Filter out servers which gets choppy and buggy when it comes to starttls. |
2 | 2 |
3 local bad_servers = module:get_option_set("tls_s2s_blacklist"); | 3 local bad_servers = module:get_option_set("tls_s2s_blacklist") |
4 local bad_servers_ip = module:get_option_set("tls_s2s_blacklist_ip"); | 4 local bad_servers_ip = module:get_option_set("tls_s2s_blacklist_ip") |
5 | 5 |
6 local function disable_tls_for_baddies_in(event) | 6 local function disable_tls_for_baddies_in(event) |
7 if bad_servers:contains(event.origin.to_host) or bad_servers_ip:contains(event.origin.conn:ip()) | 7 if bad_servers:contains(event.origin.to_host) or bad_servers_ip:contains(event.origin.conn:ip()) |
8 then event.origin.conn.starttls = nil; end | 8 then event.origin.conn.starttls = nil end |
9 end | 9 end |
10 | 10 |
11 local function disable_tls_for_baddies_out(event) | 11 local function disable_tls_for_baddies_out(event) |
12 if bad_servers:contains(event.origin.from_host) or bad_servers_ip:contains(event.origin.conn:ip()) | 12 if bad_servers:contains(event.origin.from_host) or bad_servers_ip:contains(event.origin.conn:ip()) |
13 then event.origin.conn.starttls = nil; end | 13 then event.origin.conn.starttls = nil end |
14 end | 14 end |
15 | 15 |
16 module:hook("s2s-stream-features", disable_tls_for_baddies_out, 10) | 16 module:hook("s2s-stream-features", disable_tls_for_baddies_out, 10) |
17 module:hook("stanza/http://etherx.jabber.org/streams:features", disable_tls_for_baddies_in, 510) | 17 module:hook("stanza/http://etherx.jabber.org/streams:features", disable_tls_for_baddies_in, 510) |
18 | 18 |