Mercurial > prosody-modules
comparison mod_s2s_auth_dane/mod_s2s_auth_dane.lua @ 1415:8791fa8a18c8
mod_s2s_auth_dane: Fix potential traceback in logging if SRV target fails nameprep
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 19 May 2014 17:00:12 +0200 |
| parents | 48141957f719 |
| children | 33a796b2cb91 |
comparison
equal
deleted
inserted
replaced
| 1414:48141957f719 | 1415:8791fa8a18c8 |
|---|---|
| 241 else | 241 else |
| 242 if session.cert_chain_status == "valid" and session.cert_identity_status ~= "valid" | 242 if session.cert_chain_status == "valid" and session.cert_identity_status ~= "valid" |
| 243 and session.srv_hosts and session.srv_hosts.answer and session.srv_hosts.answer.secure then | 243 and session.srv_hosts and session.srv_hosts.answer and session.srv_hosts.answer.secure then |
| 244 local srv_hosts, srv_choice, srv_target = session.srv_hosts, session.srv_choice; | 244 local srv_hosts, srv_choice, srv_target = session.srv_hosts, session.srv_choice; |
| 245 for i = srv_choice or 1, srv_choice or #srv_hosts do | 245 for i = srv_choice or 1, srv_choice or #srv_hosts do |
| 246 srv_target = nameprep(idna_to_unicode(session.srv_hosts[i].target:gsub("%.?$",""))); | 246 srv_target = session.srv_hosts[i].target:gsub("%.?$",""); |
| 247 (session.log or module._log)("debug", "Comparing certificate with Secure SRV target %s", srv_target); | 247 (session.log or module._log)("debug", "Comparing certificate with Secure SRV target %s", srv_target); |
| 248 srv_target = nameprep(idna_to_unicode()); | |
| 248 if srv_target and cert_verify_identity(srv_target, "xmpp-server", cert) then | 249 if srv_target and cert_verify_identity(srv_target, "xmpp-server", cert) then |
| 249 (session.log or module._log)("info", "Certificate matches Secure SRV target %s", srv_target); | 250 (session.log or module._log)("info", "Certificate matches Secure SRV target %s", srv_target); |
| 250 session.cert_identity_status = "valid"; | 251 session.cert_identity_status = "valid"; |
| 251 return; | 252 return; |
| 252 end | 253 end |
