aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2011-09-03 01:07:35 +0500
committerWaqas Hussain <waqas20@gmail.com>2011-09-03 01:07:35 +0500
commit25f647c874d941a87b8f0ac0f98ca8779c1bfa65 (patch)
treeae2a1e47674c9440adb4abf0207e2f2d5a9aa634
parent827d473985f251f84aa774b8bbecfa12ab29ef2f (diff)
downloadprosody-25f647c874d941a87b8f0ac0f98ca8779c1bfa65.tar.gz
prosody-25f647c874d941a87b8f0ac0f98ca8779c1bfa65.zip
mod_proxy65: Apply stringprep to activation target JID.
-rw-r--r--plugins/mod_proxy65.lua9
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"));