# HG changeset patch # User Kim Alvefur # Date 1530037733 -7200 # Node ID 365b16109d95a5a071dacdc3562ce94b1d138163 # Parent 849c4683eaa037c968b283ab03799ed04fef5378 mod_pubsub: Apply normalization to JIDs retrieved from attributes diff -r 849c4683eaa0 -r 365b16109d95 plugins/mod_pubsub/pubsub.lib.lua --- a/plugins/mod_pubsub/pubsub.lib.lua Tue Jun 26 20:27:41 2018 +0200 +++ b/plugins/mod_pubsub/pubsub.lib.lua Tue Jun 26 20:28:53 2018 +0200 @@ -1,6 +1,7 @@ local t_unpack = table.unpack or unpack; -- luacheck: ignore 113 local time_now = os.time; +local jid_prep = require "util.jid".prep; local set = require "util.set"; local st = require "util.stanza"; local it = require "util.iterators"; @@ -259,6 +260,7 @@ function handlers.set_subscribe(origin, stanza, subscribe, service) local node, jid = subscribe.attr.node, subscribe.attr.jid; + jid = jid_prep(jid); if not (node and jid) then origin.send(pubsub_error_reply(stanza, jid and "nodeid-required" or "invalid-jid")); return true; @@ -288,6 +290,7 @@ function handlers.set_unsubscribe(origin, stanza, unsubscribe, service) local node, jid = unsubscribe.attr.node, unsubscribe.attr.jid; + jid = jid_prep(jid); if not (node and jid) then origin.send(pubsub_error_reply(stanza, jid and "nodeid-required" or "invalid-jid")); return true; @@ -504,6 +507,7 @@ local jid = affiliation_tag.attr.jid; local affiliation = affiliation_tag.attr.affiliation; + jid = jid_prep(jid); if affiliation == "none" then affiliation = nil; end local ok, err = service:set_affiliation(node, stanza.attr.from, jid, affiliation);