diff mod_s2s_auth_dane/mod_s2s_auth_dane.lua @ 1355:7f68d950bdd6

mod_s2s_auth_dane: Fix for a17c2c4043e5
author Kim Alvefur <zash@zash.se>
date Tue, 18 Mar 2014 16:02:24 +0100
parents 93158d5758f3
children a74ba847195a
line wrap: on
line diff
--- a/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Tue Mar 18 15:54:08 2014 +0100
+++ b/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Tue Mar 18 16:02:24 2014 +0100
@@ -75,6 +75,8 @@
 		end, "_xmpp-server._tcp."..name..".", "SRV");
 		return true;
 	elseif host_session.direction == "outgoing" then
+		local srv_hosts = host_session.srv_hosts;
+		if not (srv_choice and srv_choice.answer and srv_choice.answer.secure) then
 		local srv_choice = host_session.srv_hosts[host_session.srv_choice];
 		host_session.dane = dns_lookup(function(answer)
 			if answer and (answer.secure and #answer > 0) or answer.bogus then
@@ -92,7 +94,7 @@
 local _try_connect = s2sout.try_connect;
 function s2sout.try_connect(host_session, connect_host, connect_port, err)
 	if not host_session.srv_hosts then
-		host_session.srv_hosts = { target = connect_host, port = connect_port };
+		host_session.srv_hosts = { answer = { secure = true }, { target = connect_host, port = connect_port } };
 		host_session.srv_choice = 1;
 	end
 	if not err and dane_lookup(host_session, _try_connect, host_session, connect_host, connect_port, err) then