diff options
author | Kim Alvefur <zash@zash.se> | 2020-02-05 23:29:39 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-02-05 23:29:39 +0100 |
commit | 6e9828ec0333eae14e05bea9e441b69a9398ebbb (patch) | |
tree | 73318ba708560703bc1532701967315e5333c038 | |
parent | 6839acc859d00f7cb4dfd91507fa8a0ab9e11355 (diff) | |
download | prosody-6e9828ec0333eae14e05bea9e441b69a9398ebbb.tar.gz prosody-6e9828ec0333eae14e05bea9e441b69a9398ebbb.zip |
mod_admin_telnet: Avoid indexing missing socket (thanks tmolitor)
if `sock` was nil it would still proceed with SNI and ALPN checks
-rw-r--r-- | plugins/mod_admin_telnet.lua | 24 |
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)"; |