aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-02-10 21:09:20 +0000
committerMatthew Wild <mwild1@gmail.com>2011-02-10 21:09:20 +0000
commit037b82e6f071c187bd2f2a7e44ea061c7a6ddc70 (patch)
tree8fa9ca73c101ad102c24049a2e3fec44da37f3ba
parent7e5bfbad2b77457fc225b8b7a58dd4f4c86c4717 (diff)
downloadprosody-037b82e6f071c187bd2f2a7e44ea061c7a6ddc70.tar.gz
prosody-037b82e6f071c187bd2f2a7e44ea061c7a6ddc70.zip
mod_presence: Bounce errors for invalid presence types (thanks nolan/Astro)
-rw-r--r--plugins/mod_presence.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 61239c9a..6d039d83 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -203,6 +203,8 @@ function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_
rostermanager.roster_push(node, host, to_bare);
end
core_post_stanza(origin, stanza);
+ else
+ origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type"));
end
stanza.attr.from, stanza.attr.to = st_from, st_to;
return true;
@@ -253,7 +255,9 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b
sessionmanager.send_to_interested_resources(node, host, stanza);
rostermanager.roster_push(node, host, from_bare);
end
- end -- discard any other type
+ else
+ origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type"));
+ end
stanza.attr.from, stanza.attr.to = st_from, st_to;
return true;
end
@@ -307,6 +311,8 @@ module:hook("presence/bare", function(data)
end -- no resources not online, discard
elseif not t or t == "unavailable" then
handle_normal_presence(origin, stanza);
+ else
+ origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type"));
end
return true;
end);