aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-03-23 20:17:46 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-03-23 20:17:46 +0500
commit155c4978477d35edbb8e6d76e959200f62ea13f7 (patch)
treeef7c0409b5e98c37564b958e0dacd54d270ab29d
parente0f77c120dbfa5a2bdd4937c23be20f311cdcabc (diff)
downloadprosody-155c4978477d35edbb8e6d76e959200f62ea13f7.tar.gz
prosody-155c4978477d35edbb8e6d76e959200f62ea13f7.zip
mod_saslauth: Tidier code for SASL backend selection.
-rw-r--r--plugins/mod_saslauth.lua14
1 files changed, 6 insertions, 8 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index d628ec30..c0360553 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -35,7 +35,9 @@ local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind';
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 @@ if sasl_backend == "cyrus" then
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 = {