Software / code / prosody
Comparison
plugins/mod_admin_telnet.lua @ 6174:513ea94761b2
mod_admin_telnet: Add c2s:show_tls(), behaves like s2s:show_tls()
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 11 May 2014 19:13:36 +0200 |
| parent | 6173:1600438c0c14 |
| child | 6175:50ddaec11f2a |
comparison
equal
deleted
inserted
replaced
| 6173:1600438c0c14 | 6174:513ea94761b2 |
|---|---|
| 218 print [[console - Help regarding the console itself]] | 218 print [[console - Help regarding the console itself]] |
| 219 elseif section == "c2s" then | 219 elseif section == "c2s" then |
| 220 print [[c2s:show(jid) - Show all client sessions with the specified JID (or all if no JID given)]] | 220 print [[c2s:show(jid) - Show all client sessions with the specified JID (or all if no JID given)]] |
| 221 print [[c2s:show_insecure() - Show all unencrypted client connections]] | 221 print [[c2s:show_insecure() - Show all unencrypted client connections]] |
| 222 print [[c2s:show_secure() - Show all encrypted client connections]] | 222 print [[c2s:show_secure() - Show all encrypted client connections]] |
| 223 print [[c2s:show_tls() - Show TLS cipher info for encrypted sessions]] | |
| 223 print [[c2s:close(jid) - Close all sessions for the specified JID]] | 224 print [[c2s:close(jid) - Close all sessions for the specified JID]] |
| 224 elseif section == "s2s" then | 225 elseif section == "s2s" then |
| 225 print [[s2s:show(domain) - Show all s2s connections for the given domain (or all if no domain given)]] | 226 print [[s2s:show(domain) - Show all s2s connections for the given domain (or all if no domain given)]] |
| 226 print [[s2s:show_tls(domain) - Show TLS cipher info for encrypted sessions]] | 227 print [[s2s:show_tls(domain) - Show TLS cipher info for encrypted sessions]] |
| 227 print [[s2s:close(from, to) - Close a connection from one domain to another]] | 228 print [[s2s:close(from, to) - Close a connection from one domain to another]] |
| 565 end | 566 end |
| 566 end); | 567 end); |
| 567 return true, "Total: "..count.." clients"; | 568 return true, "Total: "..count.." clients"; |
| 568 end | 569 end |
| 569 | 570 |
| 570 function def_env.c2s:show(match_jid) | 571 function def_env.c2s:show(match_jid, annotate) |
| 571 local print, count = self.session.print, 0; | 572 local print, count = self.session.print, 0; |
| 573 annotate = annotate or session_flags; | |
| 572 local curr_host; | 574 local curr_host; |
| 573 show_c2s(function (jid, session) | 575 show_c2s(function (jid, session) |
| 574 if curr_host ~= session.host then | 576 if curr_host ~= session.host then |
| 575 curr_host = session.host; | 577 curr_host = session.host; |
| 576 print(curr_host); | 578 print(curr_host); |
| 577 end | 579 end |
| 578 if (not match_jid) or jid:match(match_jid) then | 580 if (not match_jid) or jid:match(match_jid) then |
| 579 count = count + 1; | 581 count = count + 1; |
| 580 print(session_flags(session, { " ", jid })); | 582 print(annotate(session, { " ", jid })); |
| 581 end | 583 end |
| 582 end); | 584 end); |
| 583 return true, "Total: "..count.." clients"; | 585 return true, "Total: "..count.." clients"; |
| 584 end | 586 end |
| 585 | 587 |
| 601 count = count + 1; | 603 count = count + 1; |
| 602 print(jid); | 604 print(jid); |
| 603 end | 605 end |
| 604 end); | 606 end); |
| 605 return true, "Total: "..count.." secure client connections"; | 607 return true, "Total: "..count.." secure client connections"; |
| 608 end | |
| 609 | |
| 610 function def_env.c2s:show_tls(match_jid) | |
| 611 return self:show(match_jid, tls_info); | |
| 606 end | 612 end |
| 607 | 613 |
| 608 function def_env.c2s:close(match_jid) | 614 function def_env.c2s:close(match_jid) |
| 609 local count = 0; | 615 local count = 0; |
| 610 show_c2s(function (jid, session) | 616 show_c2s(function (jid, session) |