mod_saslauth: Add sasl_backend config parameter
authorPaul Aurich <paul@darkrain42.org>
Sat, 02 Jan 2010 20:03:24 -0800
changeset 2414 1596e0c0019b
parent 2409 36b8de1bfa27
child 2415 eb383f58624b
mod_saslauth: Add sasl_backend config parameter
plugins/mod_saslauth.lua
--- a/plugins/mod_saslauth.lua	Fri Jan 01 21:32:23 2010 +0000
+++ b/plugins/mod_saslauth.lua	Sat Jan 02 20:03:24 2010 -0800
@@ -26,6 +26,7 @@
 local config = require "core.configmanager";
 
 local secure_auth_only = config.get(module:get_host(), "core", "c2s_require_encryption") or config.get(module:get_host(), "core", "require_encryption");
+local sasl_backend = config.get(module:get_host(), "core", "sasl_backend") or "builtin";
 
 local log = module._log;
 
@@ -34,12 +35,13 @@
 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas';
 
 local new_sasl
-if config.get(module:get_host(), "core", "cyrus_service_name") then
+if sasl_backend == "cyrus" then
 	cyrus_new = require "util.sasl_cyrus".new;
 	new_sasl = function(realm)
-			return cyrus_new(realm, config.get(module:get_host(), "core", "cyrus_service_name"))
+			return cyrus_new(realm, config.get(module:get_host(), "core", "cyrus_service_name") or "xmpp")
 		end
 else
+	if sasl_backend ~= "backend" then log("warning", "Unknown SASL backend %s", sasl_backend) end;
 	new_sasl = require "util.sasl".new;
 end