Diff

plugins/mod_saslauth.lua @ 4392:d2a7a44d68c5

mod_saslauth: Never send empty <mechanisms/>.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 13 Oct 2011 00:10:02 +0500
parent 4361:605045b77bc6
child 4395:d322c4553f97
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Wed Oct 12 03:48:48 2011 +0100
+++ b/plugins/mod_saslauth.lua	Thu Oct 13 00:10:02 2011 +0500
@@ -248,8 +248,10 @@
 			return;
 		end
 		origin.sasl_handler = usermanager_get_sasl_handler(module.host);
+		local mechanisms = origin.sasl_handler:mechanisms();
+		if not next(mechanisms) then return; end
 		features:tag("mechanisms", mechanisms_attr);
-		for mechanism in pairs(origin.sasl_handler:mechanisms()) do
+		for mechanism in pairs(mechanisms) do
 			if mechanism ~= "PLAIN" or origin.secure or allow_unencrypted_plain_auth then
 				features:tag("mechanism"):text(mechanism):up();
 			end