Changeset

2928:e6380fcaffda

mod_saslauth: Tidier code for SASL backend selection.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 23 Mar 2010 20:17:46 +0500
parents 2927:c041495f0546
children 2929:1e4e314bef33
files plugins/mod_saslauth.lua
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Tue Mar 23 20:11:39 2010 +0500
+++ b/plugins/mod_saslauth.lua	Tue Mar 23 20:17:46 2010 +0500
@@ -35,7 +35,9 @@
 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas';
 
 local new_sasl;
-if sasl_backend == "cyrus" then
+if sasl_backend == "builtin" then
+	new_sasl = require "util.sasl".new;
+elseif sasl_backend == "cyrus" then
 	prosody.unlock_globals(); --FIXME: Figure out why this is needed and
 	                          -- why cyrussasl isn't caught by the sandbox
 	local ok, cyrus = pcall(require, "util.sasl_cyrus");
@@ -49,13 +51,9 @@
 		module:log("error", "Failed to load Cyrus SASL because: %s", cyrus);
 		error("Failed to load Cyrus SASL");
 	end
-end
-if not new_sasl then
-	if sasl_backend ~= "builtin" then
-		module:log("error", "Unknown SASL backend: %s", sasl_backend);
-		error("Unknown SASL backend");
-	end
-	new_sasl = require "util.sasl".new;
+else
+	module:log("error", "Unknown SASL backend: %s", sasl_backend);
+	error("Unknown SASL backend");
 end
 
 local default_authentication_profile = {