diff options
author | Waqas Hussain <waqas20@gmail.com> | 2011-09-03 01:07:35 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2011-09-03 01:07:35 +0500 |
commit | 1f1b812dc911aeb351534febd93d3fcdee72133d (patch) | |
tree | ae2a1e47674c9440adb4abf0207e2f2d5a9aa634 /plugins | |
parent | 3a5a99edeb1ff98b191ec061242d4da2bd72652c (diff) | |
download | prosody-1f1b812dc911aeb351534febd93d3fcdee72133d.tar.gz prosody-1f1b812dc911aeb351534febd93d3fcdee72133d.zip |
mod_proxy65: Apply stringprep to activation target JID.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_proxy65.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/mod_proxy65.lua b/plugins/mod_proxy65.lua index cb59cb3a..b3fc0b93 100644 --- a/plugins/mod_proxy65.lua +++ b/plugins/mod_proxy65.lua @@ -13,7 +13,7 @@ module:load("proxy65", <proxy65_jid>); local module = module; local tostring = tostring; -local jid_split, jid_join, jid_compare = require "util.jid".split, require "util.jid".join, require "util.jid".compare; +local jid_compare, jid_prep = require "util.jid".compare, require "util.jid".prep; local st = require "util.stanza"; local connlisteners = require "net.connlisteners"; local sha1 = require "util.hashes".sha1; @@ -165,10 +165,11 @@ module:hook("iq-set/host/http://jabber.org/protocol/bytestreams:query", function local sid = query.attr.sid; local from = stanza.attr.from; local to = query:get_child_text("activate"); + local prepped_to = jid_prep(to); module:log("debug", "received activation request from %s", stanza.attr.from); - if to and sid then - local sha = sha1(sid .. from .. to, true); + if prepped_to and sid then + local sha = sha1(sid .. from .. prepped_to, true); if transfers[sha] == nil then module:log("error", "transfers[sha]: nil"); origin.send(st.error_reply(stanza, "modify", "item-not-found")); @@ -187,6 +188,8 @@ module:hook("iq-set/host/http://jabber.org/protocol/bytestreams:query", function end origin.send(st.error_reply(stanza, "cancel", "not-allowed", message)); end + elseif to and sid then + origin.send(st.error_reply(stanza, "modify", "jid-malformed")); else module:log("error", "activation failed: sid: %s, initiator: %s, target: %s", tostring(sid), tostring(from), tostring(to)); origin.send(st.error_reply(stanza, "modify", "bad-request")); |