aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-19 05:09:05 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-19 05:09:05 +0000
commitf611cb1c738092e8653512f88d97b9f84f38784b (patch)
tree38bf61120fbd0879364e14e88b3e015b1f0c3440 /core
parent8b041f3cdbc219dc78f884e6418c83d03b867a5a (diff)
downloadprosody-f611cb1c738092e8653512f88d97b9f84f38784b.tar.gz
prosody-f611cb1c738092e8653512f88d97b9f84f38784b.zip
Extra checks before sending error replies to incoming stanzas
Diffstat (limited to 'core')
-rw-r--r--core/stanza_router.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 9aa923eb..46ece139 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -35,7 +35,7 @@ local jid_split = require "util.jid".split;
local print = print;
function core_process_stanza(origin, stanza)
- log("debug", "Received[%s]: %s", origin.type, stanza:pretty_top_tag())
+ (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:pretty_print()) --top_tag())
if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling.
-- TODO verify validity of stanza (as well as JID validity)
@@ -177,19 +177,19 @@ function core_handle_stanza(origin, stanza)
stanza.attr.to = nil; -- reset it
else
log("warn", "Unhandled c2s presence: %s", tostring(stanza));
- if stanza.attr.type ~= "error" then
+ if (stanza.attr.xmlns == "jabber:client" or stanza.attr.xmlns == "jabber:server") and stanza.attr.type ~= "error" then
origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
end
end
else
log("warn", "Unhandled c2s stanza: %s", tostring(stanza));
- if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+ if (stanza.attr.xmlns == "jabber:client" or stanza.attr.xmlns == "jabber:server") and stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
end
end -- TODO handle other stanzas
else
log("warn", "Unhandled origin: %s", origin.type);
- if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+ if (stanza.attr.xmlns == "jabber:client" or stanza.attr.xmlns == "jabber:server") and stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
-- s2s stanzas can get here
(origin.sends2s or origin.send)(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
end