Diff

plugins/mod_saslauth.lua @ 3385:192ffdaef491

mod_saslauth: A little cleanup for anonymous_login.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 17 Jul 2010 18:58:25 +0500
parent 3363:a4bb658d3fcb
child 3386:526b86cfbb17
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Sat Jul 17 14:50:16 2010 +0100
+++ b/plugins/mod_saslauth.lua	Sat Jul 17 18:58:25 2010 +0500
@@ -28,6 +28,7 @@
 
 local secure_auth_only = module:get_option("c2s_require_encryption") or module:get_option("require_encryption");
 local sasl_backend = module:get_option("sasl_backend") or "builtin";
+local anonymous_login = module:get_option("anonymous_login");
 
 -- Cyrus config options
 local require_provisioning = module:get_option("cyrus_require_provisioning") or false;
@@ -118,7 +119,7 @@
 local function sasl_handler(session, stanza)
 	if stanza.name == "auth" then
 		-- FIXME ignoring duplicates because ejabberd does
-		if config.get(session.host or "*", "core", "anonymous_login") then
+		if anonymous_login then
 			if stanza.attr.mechanism ~= "ANONYMOUS" then
 				return session.send(build_reply("failure", "invalid-mechanism"));
 			end
@@ -166,7 +167,7 @@
 			return;
 		end
 		local realm = module:get_option("sasl_realm") or origin.host;
-		if module:get_option("anonymous_login") then
+		if anonymous_login then
 			origin.sasl_handler = new_sasl(realm, anonymous_authentication_profile);
 		else
 			origin.sasl_handler = usermanager_get_sasl_handler(module.host);