Changeset

8695:09e7fd8b16cd

mod_pubsub: Reject publishing of non-items
author Kim Alvefur <zash@zash.se>
date Wed, 21 Mar 2018 23:41:03 +0100
parents 8694:059183e5571e
children 8696:164da3186511
files plugins/mod_pubsub/mod_pubsub.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub/mod_pubsub.lua	Wed Mar 21 23:40:45 2018 +0100
+++ b/plugins/mod_pubsub/mod_pubsub.lua	Wed Mar 21 23:41:03 2018 +0100
@@ -59,6 +59,10 @@
 	end
 end
 
+function is_item_stanza(item)
+	return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item";
+end
+
 module:hook("iq/host/"..xmlns_pubsub..":pubsub", handle_pubsub_iq);
 module:hook("iq/host/"..xmlns_pubsub_owner..":pubsub", handle_pubsub_iq);
 
@@ -207,6 +211,7 @@
 		nodestore = node_store;
 		itemstore = create_simple_itemstore;
 		broadcaster = simple_broadcast;
+		itemcheck = is_item_stanza;
 		get_affiliation = get_affiliation;
 
 		normalize_jid = jid_bare;