Comparison

plugins/mod_saslauth.lua @ 2414:1596e0c0019b

mod_saslauth: Add sasl_backend config parameter
author Paul Aurich <paul@darkrain42.org>
date Sat, 02 Jan 2010 20:03:24 -0800
parent 2398:44f694ce6aec
child 2415:eb383f58624b
comparison
equal deleted inserted replaced
2409:36b8de1bfa27 2414:1596e0c0019b
24 local jid_split = require "util.jid".split 24 local jid_split = require "util.jid".split
25 local md5 = require "util.hashes".md5; 25 local md5 = require "util.hashes".md5;
26 local config = require "core.configmanager"; 26 local config = require "core.configmanager";
27 27
28 local secure_auth_only = config.get(module:get_host(), "core", "c2s_require_encryption") or config.get(module:get_host(), "core", "require_encryption"); 28 local secure_auth_only = config.get(module:get_host(), "core", "c2s_require_encryption") or config.get(module:get_host(), "core", "require_encryption");
29 local sasl_backend = config.get(module:get_host(), "core", "sasl_backend") or "builtin";
29 30
30 local log = module._log; 31 local log = module._log;
31 32
32 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; 33 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl';
33 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; 34 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind';
34 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; 35 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas';
35 36
36 local new_sasl 37 local new_sasl
37 if config.get(module:get_host(), "core", "cyrus_service_name") then 38 if sasl_backend == "cyrus" then
38 cyrus_new = require "util.sasl_cyrus".new; 39 cyrus_new = require "util.sasl_cyrus".new;
39 new_sasl = function(realm) 40 new_sasl = function(realm)
40 return cyrus_new(realm, config.get(module:get_host(), "core", "cyrus_service_name")) 41 return cyrus_new(realm, config.get(module:get_host(), "core", "cyrus_service_name") or "xmpp")
41 end 42 end
42 else 43 else
44 if sasl_backend ~= "backend" then log("warning", "Unknown SASL backend %s", sasl_backend) end;
43 new_sasl = require "util.sasl".new; 45 new_sasl = require "util.sasl".new;
44 end 46 end
45 47
46 default_authentication_profile = { 48 default_authentication_profile = {
47 plain = function(username, realm) 49 plain = function(username, realm)