Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 12228:f60f9cd9d26c
mod_admin_shell: Use exact match instead of Lua patterns in c2s,s2s:show
It is unexpected that 'example.com' matches 'exampleicom.org' and this
use of Lua patterns is undocumented and unlikely to be widely known or
used.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 30 Jan 2022 11:10:51 +0100 |
parent | 12226:7db81c9cbbbf |
child | 12229:30ea791ce817 |
comparison
equal
deleted
inserted
replaced
12227:88958c0ecab3 | 12228:f60f9cd9d26c |
---|---|
901 local columns = get_colspec(colspec, { "id"; "jid"; "ipv"; "status"; "secure"; "smacks"; "csi" }); | 901 local columns = get_colspec(colspec, { "id"; "jid"; "ipv"; "status"; "secure"; "smacks"; "csi" }); |
902 local row = format_table(columns, 120); | 902 local row = format_table(columns, 120); |
903 | 903 |
904 local function match(session) | 904 local function match(session) |
905 local jid = get_jid(session) | 905 local jid = get_jid(session) |
906 return (not match_jid) or jid:match(match_jid) | 906 return (not match_jid) or jid == match_jid; |
907 end | 907 end |
908 | 908 |
909 local group_by_host = true; | 909 local group_by_host = true; |
910 for _, col in ipairs(columns) do | 910 for _, col in ipairs(columns) do |
911 if col.key == "full_jid" or col.key == "host" then | 911 if col.key == "full_jid" or col.key == "host" then |
984 local columns = get_colspec(colspec, { "id"; "host"; "dir"; "remote"; "ipv"; "secure"; "s2s_sasl"; "dialback" }); | 984 local columns = get_colspec(colspec, { "id"; "host"; "dir"; "remote"; "ipv"; "secure"; "s2s_sasl"; "dialback" }); |
985 local row = format_table(columns, 132); | 985 local row = format_table(columns, 132); |
986 | 986 |
987 local function match(session) | 987 local function match(session) |
988 local host, remote = get_s2s_hosts(session); | 988 local host, remote = get_s2s_hosts(session); |
989 return not match_jid or (host or ""):match(match_jid) or (remote or ""):match(match_jid); | 989 return not match_jid or host == match_jid or remote == match_jid; |
990 end | 990 end |
991 | 991 |
992 local group_by_host = true; | 992 local group_by_host = true; |
993 local currenthost = nil; | 993 local currenthost = nil; |
994 for _, col in ipairs(columns) do | 994 for _, col in ipairs(columns) do |