aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_admin_telnet.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-02-05 23:29:39 +0100
committerKim Alvefur <zash@zash.se>2020-02-05 23:29:39 +0100
commit3827fd9716252e9b74bef848fd39879dd2699950 (patch)
tree73318ba708560703bc1532701967315e5333c038 /plugins/mod_admin_telnet.lua
parentcfa4181982f768ca5d376db8db45951815429665 (diff)
downloadprosody-3827fd9716252e9b74bef848fd39879dd2699950.tar.gz
prosody-3827fd9716252e9b74bef848fd39879dd2699950.zip
mod_admin_telnet: Avoid indexing missing socket (thanks tmolitor)
if `sock` was nil it would still proceed with SNI and ALPN checks
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r--plugins/mod_admin_telnet.lua24
1 files changed, 12 insertions, 12 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index fba10faf..2485e698 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -580,20 +580,20 @@ local function tls_info(session, line)
if sock and sock.info then
local info = sock:info();
line[#line+1] = ("(%s with %s)"):format(info.protocol, info.cipher);
- 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);
+ if sock.getsniname then
+ local name = sock:getsniname();
+ if name then
+ line[#line+1] = ("(SNI:%q)"):format(name);
+ end
end
- end
- if sock.getalpn then
- local proto = sock:getalpn();
- if proto then
- line[#line+1] = ("(ALPN:%q)"):format(proto);
+ 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
else
line[#line+1] = "(insecure)";