Diff

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
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sat May 18 12:02:25 2013 +0100
+++ b/plugins/mod_admin_telnet.lua	Sat May 18 13:11:44 2013 +0200
@@ -682,9 +682,9 @@
 				error("This version of LuaSec does not support certificate viewing");
 			end
 		else
-			local certs = conn:getpeerchain();
-			local cert = certs[1];
+			local cert = conn:getpeercertificate();
 			if cert then
+				local certs = conn:getpeerchain();
 				local digest = cert:digest("sha1");
 				if not cert_set[digest] then
 					local chain_valid, chain_errors = conn:getpeerverification();