diff mod_smacks/mod_smacks.lua @ 925:720b8268778e

mod_smacks: Don't allow steam resumption onto a stream after resource binding
author Kim Alvefur <zash@zash.se>
date Sat, 09 Mar 2013 20:49:30 +0100
parents abf0f12fe75c
children fabff75bfc3f
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Thu Mar 07 18:26:07 2013 +0100
+++ b/mod_smacks/mod_smacks.lua	Sat Mar 09 20:49:30 2013 +0100
@@ -249,6 +249,14 @@
 end);
 
 module:hook_stanza(xmlns_sm, "resume", function (session, stanza)
+	if session.full_jid then
+		session.log("debug", "Tried to resume after resource binding");
+		session.send(st.stanza("failed", sm_attr)
+			:tag("unexpected-request", { xmlns = xmlns_errors })
+		);
+		return true;
+	end
+
 	local id = stanza.attr.previd;
 	local original_session = session_registry[id];
 	if not original_session then