aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-04-10 14:24:39 +0200
committerKim Alvefur <zash@zash.se>2023-04-10 14:24:39 +0200
commit2fc0c66f0123970ea3f8fdc3a460e8000eaaa1c2 (patch)
tree2bfa37ea537a06e2aaa5ed247e40549203d433fd /plugins
parentf9f118178a003c39bf43ab917cd0e49ac713eadb (diff)
downloadprosody-2fc0c66f0123970ea3f8fdc3a460e8000eaaa1c2.tar.gz
prosody-2fc0c66f0123970ea3f8fdc3a460e8000eaaa1c2.zip
mod_admin_shell: Use same wildcard matching in other s2s command
Consistency is nice.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_shell.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index b30b4ae5..217a827b 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -1191,7 +1191,7 @@ function def_env.s2s:showcert(domain)
local print = self.session.print;
local s2s_sessions = module:shared"/*/s2s/sessions";
local domain_sessions = set.new(array.collect(values(s2s_sessions)))
- /function(session) return (session.to_host == domain or session.from_host == domain) and session or nil; end;
+ /function(session) return match_s2s_jid(session, domain) and session or nil; end;
local cert_set = {};
for session in domain_sessions do
local conn = session.conn;
@@ -1294,12 +1294,11 @@ function def_env.s2s:close(from, to, text, condition)
end
for _, session in pairs(s2s_sessions) do
- local id = session.id or (session.type..tostring(session):match("[a-f0-9]+$"));
- if (match_id and match_id == id)
- or (session.from_host == from and session.to_host == to) then
+ local id = session.id or (session.type .. tostring(session):match("[a-f0-9]+$"));
+ if (match_id and match_id == id) or ((from and match_wildcard(from, session.to_host)) or (to and match_wildcard(to, session.to_host))) then
print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id));
(session.close or s2smanager.destroy_session)(session, build_reason(text, condition));
- count = count + 1 ;
+ count = count + 1;
end
end
return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s");
@@ -1309,7 +1308,7 @@ function def_env.s2s:closeall(host, text, condition)
local count = 0;
local s2s_sessions = module:shared"/*/s2s/sessions";
for _,session in pairs(s2s_sessions) do
- if not host or session.from_host == host or session.to_host == host then
+ if not host or host == "*" or match_s2s_jid(session, host) then
session:close(build_reason(text, condition));
count = count + 1;
end