Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 3066:5e5137057b5f
mod_saslauth: Split out cyrus SASL config options into locals, and add support for cyrus_application_name (default: 'prosody')
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 20 May 2010 11:51:55 +0100 |
parent | 3064:596303990c7c |
child | 3164:db9def53fe9c |
child | 3238:362b94fa5a30 |
comparison
equal
deleted
inserted
replaced
3064:596303990c7c | 3066:5e5137057b5f |
---|---|
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 = module:get_option("c2s_require_encryption") or module:get_option("require_encryption"); | 28 local secure_auth_only = module:get_option("c2s_require_encryption") or module:get_option("require_encryption"); |
29 local sasl_backend = module:get_option("sasl_backend") or "builtin"; | 29 local sasl_backend = module:get_option("sasl_backend") or "builtin"; |
30 | |
31 -- Cyrus config options | |
30 local require_provisioning = module:get_option("cyrus_require_provisioning") or false; | 32 local require_provisioning = module:get_option("cyrus_require_provisioning") or false; |
33 local cyrus_service_realm = module:get_option("cyrus_service_realm"); | |
34 local cyrus_service_name = module:get_option("cyrus_service_name"); | |
35 local cyrus_application_name = module:get_option("cyrus_application_name"); | |
31 | 36 |
32 local log = module._log; | 37 local log = module._log; |
33 | 38 |
34 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; | 39 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; |
35 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; | 40 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; |
44 local ok, cyrus = pcall(require, "util.sasl_cyrus"); | 49 local ok, cyrus = pcall(require, "util.sasl_cyrus"); |
45 prosody.lock_globals(); | 50 prosody.lock_globals(); |
46 if ok then | 51 if ok then |
47 local cyrus_new = cyrus.new; | 52 local cyrus_new = cyrus.new; |
48 new_sasl = function(realm) | 53 new_sasl = function(realm) |
49 return cyrus_new(module:get_option("cyrus_service_realm") or realm, module:get_option("cyrus_service_name") or "xmpp"); | 54 return cyrus_new( |
55 cyrus_service_realm or realm, | |
56 cyrus_service_name or "xmpp", | |
57 cyrus_application_name or "prosody" | |
58 ); | |
50 end | 59 end |
51 else | 60 else |
52 module:log("error", "Failed to load Cyrus SASL because: %s", cyrus); | 61 module:log("error", "Failed to load Cyrus SASL because: %s", cyrus); |
53 error("Failed to load Cyrus SASL"); | 62 error("Failed to load Cyrus SASL"); |
54 end | 63 end |