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 | 64240e72da2ae4eea5791fbd38f291721571f8cf (patch) | |
tree | 4a070997c3e0f24e46013e4da4a7976d1f237f87 /plugins/mod_pubsub | |
parent | 735019821777ce559cd2eacef1aaab5fc20a6a81 (diff) | |
download | prosody-64240e72da2ae4eea5791fbd38f291721571f8cf.tar.gz prosody-64240e72da2ae4eea5791fbd38f291721571f8cf.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); |