Changeset

6303:d289582d3518

mod_dialback.lua: Only check certificates on secure connections
author Kim Alvefur <zash@zash.se>
date Fri, 04 Jul 2014 23:04:56 +0200
parents 6302:76699a0ae4c4
children 6304:ace08821e4ee 6306:c6d9e21cd5f2
files plugins/mod_dialback.lua
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_dialback.lua	Fri Jul 04 22:52:34 2014 +0200
+++ b/plugins/mod_dialback.lua	Fri Jul 04 23:04:56 2014 +0200
@@ -82,12 +82,14 @@
 		local attr = stanza.attr;
 		local to, from = nameprep(attr.to), nameprep(attr.from);
 
-		if check_cert_status(origin, from) == false then
-			return
-		elseif origin.cert_chain_status == "valid" and origin.cert_identity_status == "valid" then
-			origin.sends2s(st.stanza("db:result", { to = from, from = to, id = attr.id, type = "valid" }));
-			module:fire_event("s2s-authenticated", { session = origin, host = from });
-			return true;
+		if origin.secure then
+			if check_cert_status(origin, from) == false then
+				return
+			elseif origin.cert_chain_status == "valid" and origin.cert_identity_status == "valid" then
+				origin.sends2s(st.stanza("db:result", { to = from, from = to, id = attr.id, type = "valid" }));
+				module:fire_event("s2s-authenticated", { session = origin, host = from });
+				return true;
+			end
 		end
 
 		if not hosts[to] then