Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 3463:1644ab13a4ca
mod_saslauth: Get rid of most Cyrus SASL related code (use authentication='cyrus' instead).
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 23 Aug 2010 16:22:58 +0500 |
parent | 3418:e75af8e6af54 |
child | 3464:72cd7a785014 |
comparison
equal
deleted
inserted
replaced
3462:cf72ef3c9009 | 3463:1644ab13a4ca |
---|---|
24 local anonymous_login = module:get_option("anonymous_login"); | 24 local anonymous_login = module:get_option("anonymous_login"); |
25 local allow_unencrypted_plain_auth = module:get_option("allow_unencrypted_plain_auth") | 25 local allow_unencrypted_plain_auth = module:get_option("allow_unencrypted_plain_auth") |
26 | 26 |
27 -- Cyrus config options | 27 -- Cyrus config options |
28 local require_provisioning = module:get_option("cyrus_require_provisioning") or false; | 28 local require_provisioning = module:get_option("cyrus_require_provisioning") or false; |
29 local cyrus_service_realm = module:get_option("cyrus_service_realm"); | |
30 local cyrus_service_name = module:get_option("cyrus_service_name"); | |
31 local cyrus_application_name = module:get_option("cyrus_application_name"); | |
32 | 29 |
33 local log = module._log; | 30 local log = module._log; |
34 | 31 |
35 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; | 32 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl'; |
36 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; | 33 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind'; |
37 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; | 34 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; |
38 | 35 |
39 local new_sasl; | 36 local new_sasl = require "util.sasl".new; |
40 if sasl_backend == "builtin" then | 37 if sasl_backend ~= "builtin" then |
41 new_sasl = require "util.sasl".new; | |
42 elseif sasl_backend == "cyrus" then | |
43 prosody.unlock_globals(); --FIXME: Figure out why this is needed and | |
44 -- why cyrussasl isn't caught by the sandbox | |
45 local ok, cyrus = pcall(require, "util.sasl_cyrus"); | |
46 prosody.lock_globals(); | |
47 if ok then | |
48 local cyrus_new = cyrus.new; | |
49 new_sasl = function(realm) | |
50 return cyrus_new( | |
51 cyrus_service_realm or realm, | |
52 cyrus_service_name or "xmpp", | |
53 cyrus_application_name or "prosody" | |
54 ); | |
55 end | |
56 else | |
57 module:log("error", "Failed to load Cyrus SASL because: %s", cyrus); | |
58 error("Failed to load Cyrus SASL"); | |
59 end | |
60 else | |
61 module:log("error", "Unknown SASL backend: %s", sasl_backend); | 38 module:log("error", "Unknown SASL backend: %s", sasl_backend); |
62 error("Unknown SASL backend"); | 39 error("Unknown SASL backend"); |
63 end | 40 end |
64 | 41 |
65 local anonymous_authentication_profile = { | 42 local anonymous_authentication_profile = { |