Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 13869:f44f2a8a8c37 13.0
mod_admin_shell: Fix matching logic in s2s:close (Thanks Menel)
It was matching 'from' on the wrong field and the boolean logic was
wrong.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 28 Apr 2025 19:41:19 +0200 |
parent | 13828:a071b20ccc0f |
comparison
equal
deleted
inserted
replaced
13868:14b52f217f7a | 13869:f44f2a8a8c37 |
---|---|
1585 return false, "Both from and to are the same... you can't do that :)"; | 1585 return false, "Both from and to are the same... you can't do that :)"; |
1586 end | 1586 end |
1587 | 1587 |
1588 for _, session in pairs(s2s_sessions) do | 1588 for _, session in pairs(s2s_sessions) do |
1589 local id = session.id or (session.type .. tostring(session):match("[a-f0-9]+$")); | 1589 local id = session.id or (session.type .. tostring(session):match("[a-f0-9]+$")); |
1590 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 | 1590 if (match_id and match_id == id) or ((from and match_wildcard(from, session.from_host)) and (to and match_wildcard(to, session.to_host))) then |
1591 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id)); | 1591 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id)); |
1592 (session.close or s2smanager.destroy_session)(session, build_reason(text, condition)); | 1592 (session.close or s2smanager.destroy_session)(session, build_reason(text, condition)); |
1593 count = count + 1; | 1593 count = count + 1; |
1594 end | 1594 end |
1595 end | 1595 end |