Changeset

10644:6c4ab1b87588

mod_admin_telnet: Avoid indexing missing socket (thanks tmolitor) if `sock` was nil it would still proceed with SNI and ALPN checks
author Kim Alvefur <zash@zash.se>
date Wed, 05 Feb 2020 23:29:39 +0100
parents 10643:417eadd0f567
children 10645:067ada779ea5
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Wed Feb 05 17:56:44 2020 +0000
+++ b/plugins/mod_admin_telnet.lua	Wed Feb 05 23:29:39 2020 +0100
@@ -580,21 +580,21 @@
 		if sock and sock.info then
 			local info = sock:info();
 			line[#line+1] = ("(%s with %s)"):format(info.protocol, info.cipher);
+			if sock.getsniname then
+				local name = sock:getsniname();
+				if name then
+					line[#line+1] = ("(SNI:%q)"):format(name);
+				end
+			end
+			if sock.getalpn then
+				local proto = sock:getalpn();
+				if proto then
+					line[#line+1] = ("(ALPN:%q)"):format(proto);
+				end
+			end
 		else
 			line[#line+1] = "(cipher info unavailable)";
 		end
-		if sock.getsniname then
-			local name = sock:getsniname();
-			if name then
-				line[#line+1] = ("(SNI:%q)"):format(name);
-			end
-		end
-		if sock.getalpn then
-			local proto = sock:getalpn();
-			if proto then
-				line[#line+1] = ("(ALPN:%q)"):format(proto);
-			end
-		end
 	else
 		line[#line+1] = "(insecure)";
 	end