Software /
code /
prosody
Comparison
plugins/mod_saslauth.lua @ 2642:333d7e2033b2
mod_saslauth: Warn and fallback gracefully when Cyrus SASL is requested, but missing.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 15 Feb 2010 02:51:07 +0500 |
parent | 2634:e486aca8c5d1 |
child | 2646:064efb684aff |
comparison
equal
deleted
inserted
replaced
2641:b083a667e3be | 2642:333d7e2033b2 |
---|---|
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'; |
35 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; | 35 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas'; |
36 | 36 |
37 local new_sasl | 37 local new_sasl; |
38 if sasl_backend == "cyrus" then | 38 if sasl_backend == "cyrus" then |
39 local cyrus_new = require "util.sasl_cyrus".new; | 39 local cyrus, err = pcall(require, "util.sasl_cyrus"); |
40 new_sasl = function(realm) | 40 if cyrus then |
41 return cyrus_new(realm, module:get_option("cyrus_service_name") or "xmpp"); | 41 local cyrus_new = cyrus.new; |
42 end | 42 new_sasl = function(realm) |
43 else | 43 return cyrus_new(realm, module:get_option("cyrus_service_name") or "xmpp"); |
44 end | |
45 else | |
46 sasl_backend = "builtin"; | |
47 module:log("warn", "Failed to load Cyrus SASL, falling back to builtin auth mechanisms"); | |
48 end | |
49 end | |
50 if not new_sasl then | |
44 if sasl_backend ~= "builtin" then module:log("warn", "Unknown SASL backend %s", sasl_backend); end; | 51 if sasl_backend ~= "builtin" then module:log("warn", "Unknown SASL backend %s", sasl_backend); end; |
45 new_sasl = require "util.sasl".new; | 52 new_sasl = require "util.sasl".new; |
46 end | 53 end |
47 | 54 |
48 local default_authentication_profile = { | 55 local default_authentication_profile = { |