comparison mod_s2s_auth_fingerprint/mod_s2s_auth_fingerprint.lua @ 939:1415fc2a0ac0

mod_s2s_auth_fingerprint: Make sure we actually got a certificate
author Kim Alvefur <zash@zash.se>
date Mon, 25 Mar 2013 06:40:05 +0100
parents d0e71a3bd2c4
children e7b69d12fbfb
comparison
equal deleted inserted replaced
938:d0e71a3bd2c4 939:1415fc2a0ac0
25 25
26 module:hook("s2s-check-certificate", function(event) 26 module:hook("s2s-check-certificate", function(event)
27 local session, host, cert = event.session, event.host, event.cert; 27 local session, host, cert = event.session, event.host, event.cert;
28 28
29 local host_fingerprints = fingerprints[host]; 29 local host_fingerprints = fingerprints[host];
30 if host_fingerprints then 30 if cert and host_fingerprints then
31 local digest = cert:digest(digest_algo); 31 local digest = cert:digest(digest_algo);
32 if host_fingerprints[digest] then 32 if host_fingerprints[digest] then
33 session.cert_chain_status = "valid"; 33 session.cert_chain_status = "valid";
34 session.cert_identity_status = "valid"; 34 session.cert_identity_status = "valid";
35 return true; 35 return true;