# HG changeset patch # User Kim Alvefur # Date 1580941779 -3600 # Node ID 6c4ab1b8758881332ec9c3025ba0046db41fbbb5 # Parent 417eadd0f567feebddc79eeee2199e0f0e398587 mod_admin_telnet: Avoid indexing missing socket (thanks tmolitor) if `sock` was nil it would still proceed with SNI and ALPN checks diff -r 417eadd0f567 -r 6c4ab1b87588 plugins/mod_admin_telnet.lua --- 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