aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-05-13 16:55:20 +0100
committerMatthew Wild <mwild1@gmail.com>2009-05-13 16:55:20 +0100
commitbc1c94544b1072f333acb86613a1b81c5b3428f8 (patch)
treeb6c06bd43e57aab7fba8046ef014de9cefa783b7 /core/stanza_router.lua
parent680cdc8f29f2c5becdc782395d4a108a69947aa4 (diff)
parent482dc64bc93ed1ea413f0ae63ebe6e854783e338 (diff)
downloadprosody-bc1c94544b1072f333acb86613a1b81c5b3428f8.tar.gz
prosody-bc1c94544b1072f333acb86613a1b81c5b3428f8.zip
Merge with 0.4
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 22c1abb0..eb5bf410 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -80,16 +80,21 @@ function core_process_stanza(origin, stanza)
if to then
node, host, resource = jid_prepped_split(to);
if not host then
- error("Invalid to JID");
+ log("warn", "Received stanza with invalid destination JID: %s", to);
+ origin.send(st.error_reply(stanza, "modify", "jid-malformed", "The destination address is invalid: "..to));
+ return;
end
to_bare = node and (node.."@"..host) or host; -- bare JID
if resource then to = to_bare.."/"..resource; else to = to_bare; end
stanza.attr.to = to;
end
if from then
+ -- We only stamp the 'from' on c2s stanzas, so we still need to check validity
from_node, from_host, from_resource = jid_prepped_split(from);
if not from_host then
- error("Invalid from JID");
+ log("warn", "Received stanza with invalid source JID: %s", from);
+ origin.send(st.error_reply(stanza, "modify", "jid-malformed", "The source address is invalid: "..from));
+ return;
end
from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID
if from_resource then from = from_bare.."/"..from_resource; else from = from_bare; end