mod_admin_telnet: Don't rely on getpeerchain returning an empty list
authorKim Alvefur <zash@zash.se>
Sat, 18 May 2013 13:11:44 +0200
changeset 5596 73fea1a87afd
parent 5594 ad66ee47b674
child 5597 6fe09707c73b
mod_admin_telnet: Don't rely on getpeerchain returning an empty list
plugins/mod_admin_telnet.lua
--- 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();