Comparison

plugins/mod_admin_telnet.lua @ 5596:73fea1a87afd

mod_admin_telnet: Don't rely on getpeerchain returning an empty list
author Kim Alvefur <zash@zash.se>
date Sat, 18 May 2013 13:11:44 +0200
parent 5567:c4ab25b35a55
child 5598:3bb8aefd8ce0
comparison
equal deleted inserted replaced
5594:ad66ee47b674 5596:73fea1a87afd
680 if not conn.getpeerchain then 680 if not conn.getpeerchain then
681 if conn.dohandshake then 681 if conn.dohandshake then
682 error("This version of LuaSec does not support certificate viewing"); 682 error("This version of LuaSec does not support certificate viewing");
683 end 683 end
684 else 684 else
685 local certs = conn:getpeerchain(); 685 local cert = conn:getpeercertificate();
686 local cert = certs[1];
687 if cert then 686 if cert then
687 local certs = conn:getpeerchain();
688 local digest = cert:digest("sha1"); 688 local digest = cert:digest("sha1");
689 if not cert_set[digest] then 689 if not cert_set[digest] then
690 local chain_valid, chain_errors = conn:getpeerverification(); 690 local chain_valid, chain_errors = conn:getpeerverification();
691 cert_set[digest] = { 691 cert_set[digest] = {
692 { 692 {