diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-02-15 02:51:07 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-02-15 02:51:07 +0500 |
commit | 93d80250eb99d5fac82a09405557844ed3fea2df (patch) | |
tree | 44dd7493d6d2cebac9cf213415c5bbf045cd26ee | |
parent | 673df8d1d25a66903a9a2b2fdd96bac8aad09485 (diff) | |
download | prosody-93d80250eb99d5fac82a09405557844ed3fea2df.tar.gz prosody-93d80250eb99d5fac82a09405557844ed3fea2df.zip |
mod_saslauth: Warn and fallback gracefully when Cyrus SASL is requested, but missing.
-rw-r--r-- | plugins/mod_saslauth.lua | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index be324b24..398ae9f8 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -34,13 +34,20 @@ local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; -local new_sasl +local new_sasl; if sasl_backend == "cyrus" then - local cyrus_new = require "util.sasl_cyrus".new; - new_sasl = function(realm) - return cyrus_new(realm, module:get_option("cyrus_service_name") or "xmpp"); + local cyrus, err = pcall(require, "util.sasl_cyrus"); + if cyrus then + local cyrus_new = cyrus.new; + new_sasl = function(realm) + return cyrus_new(realm, module:get_option("cyrus_service_name") or "xmpp"); + end + else + sasl_backend = "builtin"; + module:log("warn", "Failed to load Cyrus SASL, falling back to builtin auth mechanisms"); end -else +end +if not new_sasl then if sasl_backend ~= "builtin" then module:log("warn", "Unknown SASL backend %s", sasl_backend); end; new_sasl = require "util.sasl".new; end |