# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1347558515 -3600
# Node ID a0673b644f05bae7a022dbe6b3e9cf07055cf2d5
# Parent  a4a74a0e9b9c84448d2506d43726762be6c2ca8c
mod_legacyauth: Fix for sending error response to unauthed s2s connections

diff -r a4a74a0e9b9c -r a0673b644f05 plugins/mod_legacyauth.lua
--- a/plugins/mod_legacyauth.lua	Thu Sep 13 18:31:34 2012 +0100
+++ b/plugins/mod_legacyauth.lua	Thu Sep 13 18:48:35 2012 +0100
@@ -35,7 +35,7 @@
 	local session, stanza = event.origin, event.stanza;
 
 	if session.type ~= "c2s_unauthed" then
-		session.send(st.error_reply(stanza, "cancel", "service-unavailable", "Legacy authentication is only allowed for unauthenticated client connections."));
+		(session.sends2s or session.send)(st.error_reply(stanza, "cancel", "service-unavailable", "Legacy authentication is only allowed for unauthenticated client connections."));
 		return true;
 	end