Mercurial > prosody-hg
comparison plugins/mod_saslauth.lua @ 2415:eb383f58624b
mod_saslauth: Use module:get_option()
| author | Paul Aurich <paul@darkrain42.org> |
|---|---|
| date | Sun, 03 Jan 2010 09:51:01 -0800 |
| parents | 1596e0c0019b |
| children | c35deaea53b9 |
comparison
equal
deleted
inserted
replaced
| 2414:1596e0c0019b | 2415:eb383f58624b |
|---|---|
| 23 local tostring = tostring; | 23 local tostring = tostring; |
| 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 = module:get_option("c2s_require_encryption") or module:get_option("require_encryption"); |
| 29 local sasl_backend = config.get(module:get_host(), "core", "sasl_backend") or "builtin"; | 29 local sasl_backend = module:get_option("sasl_backend") or "builtin"; |
| 30 | 30 |
| 31 local log = module._log; | 31 local log = module._log; |
| 32 | 32 |
| 33 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; | 33 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; |
| 34 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; | 34 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; |
| 36 | 36 |
| 37 local new_sasl | 37 local new_sasl |
| 38 if sasl_backend == "cyrus" then | 38 if sasl_backend == "cyrus" then |
| 39 cyrus_new = require "util.sasl_cyrus".new; | 39 cyrus_new = require "util.sasl_cyrus".new; |
| 40 new_sasl = function(realm) | 40 new_sasl = function(realm) |
| 41 return cyrus_new(realm, config.get(module:get_host(), "core", "cyrus_service_name") or "xmpp") | 41 return cyrus_new(realm, module:get_option("cyrus_service_name") or "xmpp") |
| 42 end | 42 end |
| 43 else | 43 else |
| 44 if sasl_backend ~= "backend" then log("warning", "Unknown SASL backend %s", sasl_backend) end; | 44 if sasl_backend ~= "backend" then log("warning", "Unknown SASL backend %s", sasl_backend) end; |
| 45 new_sasl = require "util.sasl".new; | 45 new_sasl = require "util.sasl".new; |
| 46 end | 46 end |
