Diff

core/stanza_router.lua @ 81:a1f4f3c5ae25

Merge roster fixes from waqas
author Matthew Wild <mwild1@gmail.com>
date Wed, 08 Oct 2008 17:27:20 +0100
parent 78:972e31cc91e8
child 83:79608fc8f98d
line wrap: on
line diff
--- a/core/stanza_router.lua	Wed Oct 08 17:20:11 2008 +0100
+++ b/core/stanza_router.lua	Wed Oct 08 17:27:20 2008 +0100
@@ -16,6 +16,13 @@
 function core_process_stanza(origin, stanza)
 	log("debug", "Received: "..tostring(stanza))
 	-- TODO verify validity of stanza (as well as JID validity)
+
+	if origin.type == "c2s" and not origin.full_jid
+		and not(stanza.name == "iq" and stanza.tags[1] and stanza.tags[1].name == "bind"
+				and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then
+		error("Client MUST bind resource after auth");
+	end
+
 	
 	local to = stanza.attr.to;
 	stanza.attr.from = origin.full_jid -- quick fix to prevent impersonation