changeset 924:0a78ac54bd03

mod_s2s_never_encrypt_blacklist: conn objects on libev carry a metatable, perhaps have starttls set to false instead of nil.
author Marco Cirillo <maranda@lightwitch.org>
date Thu, 07 Mar 2013 18:26:07 +0100
parents 5f38d762d071
children 720b8268778e 9eefbaba274d
files mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua	Thu Mar 07 16:57:17 2013 +0100
+++ b/mod_s2s_never_encrypt_blacklist/mod_s2s_never_encrypt_blacklist.lua	Thu Mar 07 18:26:07 2013 +0100
@@ -2,12 +2,13 @@
 
 local bad_servers = module:get_option_set("tls_s2s_blacklist", {})
 local bad_servers_ip = module:get_option_set("tls_s2s_blacklist_ip", {})
+local libev = module:get_option_boolean("use_libevent")
 
 local function disable_tls_for_baddies_in(event)
 	local session = event.origin
 	if bad_servers:contains(session.from_host) or bad_servers_ip:contains(session.conn:ip()) then 
 		module:log("debug", "disabling tls on incoming stream from %s...", tostring(session.from_host));
-		session.conn.starttls = nil;
+		if libev then session.conn.starttls = false; else session.conn.starttls = nil; end
 	end
 end
 
@@ -15,7 +16,7 @@
 	local session = event.origin
 	if bad_servers:contains(session.to_host) then
 		module:log("debug", "disabling tls on outgoing stream from %s...", tostring(session.to_host));
-		session.conn.starttls = nil;
+		if libev then session.conn.starttls = false; else session.conn.starttls = nil; end
 	end
 end