# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1400511612 -7200
# Node ID 8791fa8a18c8475bce04f91f6e4303c5d75ff41b
# Parent  48141957f71926493dfe94819247466b37b1959f
mod_s2s_auth_dane: Fix potential traceback in logging if SRV target fails nameprep

diff -r 48141957f719 -r 8791fa8a18c8 mod_s2s_auth_dane/mod_s2s_auth_dane.lua
--- a/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Mon May 19 16:28:43 2014 +0200
+++ b/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Mon May 19 17:00:12 2014 +0200
@@ -243,8 +243,9 @@
 		and session.srv_hosts and session.srv_hosts.answer and session.srv_hosts.answer.secure then
 			local srv_hosts, srv_choice, srv_target = session.srv_hosts, session.srv_choice;
 			for i = srv_choice or 1, srv_choice or #srv_hosts do
-				srv_target = nameprep(idna_to_unicode(session.srv_hosts[i].target:gsub("%.?$","")));
+				srv_target = session.srv_hosts[i].target:gsub("%.?$","");
 				(session.log or module._log)("debug", "Comparing certificate with Secure SRV target %s", srv_target);
+				srv_target = nameprep(idna_to_unicode());
 				if srv_target and cert_verify_identity(srv_target, "xmpp-server", cert) then
 					(session.log or module._log)("info", "Certificate matches Secure SRV target %s", srv_target);
 					session.cert_identity_status = "valid";