comparison 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
comparison
equal deleted inserted replaced
1354:93158d5758f3 1355:7f68d950bdd6
73 end, ("_%d._tcp.%s."):format(record.srv.port, record.srv.target), "TLSA"); 73 end, ("_%d._tcp.%s."):format(record.srv.port, record.srv.target), "TLSA");
74 end 74 end
75 end, "_xmpp-server._tcp."..name..".", "SRV"); 75 end, "_xmpp-server._tcp."..name..".", "SRV");
76 return true; 76 return true;
77 elseif host_session.direction == "outgoing" then 77 elseif host_session.direction == "outgoing" then
78 local srv_hosts = host_session.srv_hosts;
79 if not (srv_choice and srv_choice.answer and srv_choice.answer.secure) then
78 local srv_choice = host_session.srv_hosts[host_session.srv_choice]; 80 local srv_choice = host_session.srv_hosts[host_session.srv_choice];
79 host_session.dane = dns_lookup(function(answer) 81 host_session.dane = dns_lookup(function(answer)
80 if answer and (answer.secure and #answer > 0) or answer.bogus then 82 if answer and (answer.secure and #answer > 0) or answer.bogus then
81 srv_choice.dane = answer; 83 srv_choice.dane = answer;
82 else 84 else
90 end 92 end
91 93
92 local _try_connect = s2sout.try_connect; 94 local _try_connect = s2sout.try_connect;
93 function s2sout.try_connect(host_session, connect_host, connect_port, err) 95 function s2sout.try_connect(host_session, connect_host, connect_port, err)
94 if not host_session.srv_hosts then 96 if not host_session.srv_hosts then
95 host_session.srv_hosts = { target = connect_host, port = connect_port }; 97 host_session.srv_hosts = { answer = { secure = true }, { target = connect_host, port = connect_port } };
96 host_session.srv_choice = 1; 98 host_session.srv_choice = 1;
97 end 99 end
98 if not err and dane_lookup(host_session, _try_connect, host_session, connect_host, connect_port, err) then 100 if not err and dane_lookup(host_session, _try_connect, host_session, connect_host, connect_port, err) then
99 return true; 101 return true;
100 end 102 end