diff options
author | Kim Alvefur <zash@zash.se> | 2018-06-26 20:28:53 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-06-26 20:28:53 +0200 |
commit | 56ec5570c7fbe9ab814643731b24c271b1f106f3 (patch) | |
tree | 4a070997c3e0f24e46013e4da4a7976d1f237f87 /plugins/mod_pubsub | |
parent | 34e33be1e52536be5529c19feb2e3270c3083608 (diff) | |
download | prosody-56ec5570c7fbe9ab814643731b24c271b1f106f3.tar.gz prosody-56ec5570c7fbe9ab814643731b24c271b1f106f3.zip |
mod_pubsub: Apply normalization to JIDs retrieved from attributes
Diffstat (limited to 'plugins/mod_pubsub')
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index 8b15fca0..2ec6e8de 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -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 @@ end 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 @@ end 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 @@ function handlers.owner_set_affiliations(origin, stanza, affiliations, service) 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); |