From 4414f8402faea1b1c059487af692da7d432c68bc Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 27 Apr 2024 15:55:23 +0200 Subject: mod_blocklist: Drop blocked messages without error, option to restore compliant behavior From XEP-0191: > For message stanzas, the server SHOULD return an error, which SHOULD > be . Following this may leak to a blocked JID that they have been blocked, which seems contrary to the goal of pretending to be perpetually offline. --- plugins/mod_blocklist.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua index dad06b62..6b8ce16c 100644 --- a/plugins/mod_blocklist.lua +++ b/plugins/mod_blocklist.lua @@ -322,8 +322,13 @@ local prio_in, prio_out = 100, 100; module:hook("presence/bare", drop_stanza, prio_in); module:hook("presence/full", drop_stanza, prio_in); -module:hook("message/bare", bounce_message, prio_in); -module:hook("message/full", bounce_message, prio_in); +if module:get_option_boolean("bounce_blocked_messages", false) then + module:hook("message/bare", bounce_message, prio_in); + module:hook("message/full", bounce_message, prio_in); +else + module:hook("message/bare", drop_stanza, prio_in); + module:hook("message/full", drop_stanza, prio_in); +end module:hook("iq/bare", bounce_iq, prio_in); module:hook("iq/full", bounce_iq, prio_in); -- cgit v1.2.3 From f3b1b57a70a41c97cbfe42c3d98118b2bc2c9901 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 31 Mar 2023 22:01:27 +0200 Subject: mod_admin_shell: Allow matching on host or bare JID in c2s:show Only supporting exact match on full JID isn't helpful if you want to list sessions per host or user. Backport of 430333198e4c Fixes #1857 --- plugins/mod_admin_shell.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index ee68a64b..f2da286b 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -25,7 +25,7 @@ local prosody = _G.prosody; local unpack = table.unpack or unpack; -- luacheck: ignore 113 local iterators = require "util.iterators"; local keys, values = iterators.keys, iterators.values; -local jid_bare, jid_split, jid_join = import("util.jid", "bare", "prepped_split", "join"); +local jid_bare, jid_split, jid_join, jid_compare = import("util.jid", "bare", "prepped_split", "join", "compare"); local set, array = require "util.set", require "util.array"; local cert_verify_identity = require "util.x509".verify_identity; local envload = require "util.envload".envload; @@ -940,7 +940,7 @@ function def_env.c2s:show(match_jid, colspec) local function match(session) local jid = get_jid(session) - return (not match_jid) or jid == match_jid; + return (not match_jid) or jid_compare(jid, match_jid); end local group_by_host = true; -- cgit v1.2.3