Changeset

1268:dc1f95b37024

mod_iq: Correctly handle the lack of 'to' on IQs
author Waqas Hussain <waqas20@gmail.com>
date Mon, 01 Jun 2009 11:16:48 +0500
parents 1267:1bf897de6c24
children 1269:b06d6674477b
files plugins/mod_iq.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_iq.lua	Mon Jun 01 10:44:05 2009 +0500
+++ b/plugins/mod_iq.lua	Mon Jun 01 11:16:48 2009 +0500
@@ -26,8 +26,9 @@
 	-- IQ to bare JID recieved
 	local origin, stanza = data.origin, data.stanza;
 
-	if not bare_sessions[stanza.attr.to] then -- quick check for account existance
-		local node, host = jid_split(stanza.attr.to);
+	local to = stanza.attr.to;
+	if to and not bare_sessions[to] then -- quick check for account existance
+		local node, host = jid_split(to);
 		if not user_exists(node, host) then -- full check for account existance
 			if stanza.attr.type == "get" or stanza.attr.type == "set" then
 				origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));