From ba50691289cdca1eb574e3e6231ec27d50c2ce67 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 10 Jan 2022 22:15:55 +0100 Subject: mod_bookmarks: Block publishing to older XEP-0402 v0.3.0 node Having both the :0 and :1 nodes would be especially awkward, since there is no upgrade path for this case. In theory, these should be rare since no clients should have been doing XEP-0402 unless mod_bookmarks(2) was enabled. This was guesstimated to be rare with most clients doing XEP-0048 with Private XML. --- plugins/mod_bookmarks.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'plugins/mod_bookmarks.lua') diff --git a/plugins/mod_bookmarks.lua b/plugins/mod_bookmarks.lua index fc37f09a..1e89053a 100644 --- a/plugins/mod_bookmarks.lua +++ b/plugins/mod_bookmarks.lua @@ -10,6 +10,7 @@ local mod_pep = module:depends "pep"; local private_storage = module:open_store("private", "map"); local namespace = "urn:xmpp:bookmarks:1"; +local namespace_old = "urn:xmpp:bookmarks:0"; local namespace_private = "jabber:iq:private"; local namespace_legacy = "storage:bookmarks"; local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; @@ -271,7 +272,13 @@ local function on_publish_legacy_pep(event) end local publish = pubsub:get_child("publish"); - if publish == nil or publish.attr.node ~= namespace_legacy then + if publish == nil then return end + if publish.attr.node == namespace_old then + session.send(st.error_reply(stanza, "modify", "not-allowed", + "Your client does XEP-0402 version 0.3.0 but 0.4.0+ is required")); + return true; + end + if publish.attr.node ~= namespace_legacy then return; end -- cgit v1.2.3