aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-12-06 07:24:15 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-12-06 07:24:15 +0500
commitbfe08e485c3b4eaaae5841c48aec22499bbf56ff (patch)
treeaecbe5fcbace6267b36e945a73d26297cbae0781 /core/stanza_router.lua
parentc92d90f3f5a13c4d30bf7f6b68bf539a3a84b867 (diff)
downloadprosody-bfe08e485c3b4eaaae5841c48aec22499bbf56ff.tar.gz
prosody-bfe08e485c3b4eaaae5841c48aec22499bbf56ff.zip
Fixed: Stopped tryint to send error replies on unauthed connections
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua33
1 files changed, 17 insertions, 16 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index e5086b67..c2214b1c 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -121,30 +121,31 @@ end
function core_handle_stanza(origin, stanza)
-- Handlers
if modules_handle_stanza(stanza.attr.to or origin.host, origin, stanza) then return; end
- if origin.type == "c2s" or origin.type == "c2s_unauthed" then
- local session = origin;
-
- if stanza.name == "presence" and origin.roster then
- if stanza.attr.type == nil or stanza.attr.type == "unavailable" then
- handle_normal_presence(origin, stanza, core_route_stanza);
+ if origin.type == "c2s" or origin.type == "s2sin" then
+ if origin.type == "c2s" then
+ if stanza.name == "presence" and origin.roster then
+ if stanza.attr.type == nil or stanza.attr.type == "unavailable" then
+ handle_normal_presence(origin, stanza, core_route_stanza);
+ else
+ log("warn", "Unhandled c2s presence: %s", tostring(stanza));
+ 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 presence: %s", tostring(stanza));
- if (stanza.attr.xmlns == "jabber:client" or stanza.attr.xmlns == "jabber:server") and stanza.attr.type ~= "error" then
+ log("warn", "Unhandled c2s stanza: %s", tostring(stanza));
+ 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
- else
- log("warn", "Unhandled c2s stanza: %s", tostring(stanza));
+ else -- s2s stanzas
+ log("warn", "Unhandled s2s stanza: %s", tostring(stanza));
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.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.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME correct error?
end
+ else
+ log("warn", "Unhandled %s stanza: %s", origin.type, tostring(stanza));
end
end