plugins/mod_saslauth.lua
changeset 3464 72cd7a785014
parent 3463 1644ab13a4ca
child 3468 d50e2c937717
equal deleted inserted replaced
3463:1644ab13a4ca 3464:72cd7a785014
    18 local usermanager_user_exists = require "core.usermanager".user_exists;
    18 local usermanager_user_exists = require "core.usermanager".user_exists;
    19 local t_concat, t_insert = table.concat, table.insert;
    19 local t_concat, t_insert = table.concat, table.insert;
    20 local tostring = tostring;
    20 local tostring = tostring;
    21 
    21 
    22 local secure_auth_only = module:get_option("c2s_require_encryption") or module:get_option("require_encryption");
    22 local secure_auth_only = module:get_option("c2s_require_encryption") or module:get_option("require_encryption");
    23 local sasl_backend = module:get_option("sasl_backend") or "builtin";
       
    24 local anonymous_login = module:get_option("anonymous_login");
    23 local anonymous_login = module:get_option("anonymous_login");
    25 local allow_unencrypted_plain_auth = module:get_option("allow_unencrypted_plain_auth")
    24 local allow_unencrypted_plain_auth = module:get_option("allow_unencrypted_plain_auth")
    26 
    25 
    27 -- Cyrus config options
    26 -- Cyrus config options
    28 local require_provisioning = module:get_option("cyrus_require_provisioning") or false;
    27 local require_provisioning = module:get_option("cyrus_require_provisioning") or false;
    32 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl';
    31 local xmlns_sasl ='urn:ietf:params:xml:ns:xmpp-sasl';
    33 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind';
    32 local xmlns_bind ='urn:ietf:params:xml:ns:xmpp-bind';
    34 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas';
    33 local xmlns_stanzas ='urn:ietf:params:xml:ns:xmpp-stanzas';
    35 
    34 
    36 local new_sasl = require "util.sasl".new;
    35 local new_sasl = require "util.sasl".new;
    37 if sasl_backend ~= "builtin" then
       
    38 	module:log("error", "Unknown SASL backend: %s", sasl_backend);
       
    39 	error("Unknown SASL backend");
       
    40 end
       
    41 
    36 
    42 local anonymous_authentication_profile = {
    37 local anonymous_authentication_profile = {
    43 	anonymous = function(username, realm)
    38 	anonymous = function(username, realm)
    44 		return true; -- for normal usage you should always return true here
    39 		return true; -- for normal usage you should always return true here
    45 	end
    40 	end