util/sasl.lua

changeset 3986
671a660b20f9
parent 3550
5e5d136d9de0
equal deleted inserted replaced
3985:277b5bf9a200 3986:671a660b20f9
46 end 46 end
47 end 47 end
48 48
49 -- create a new SASL object which can be used to authenticate clients 49 -- create a new SASL object which can be used to authenticate clients
50 function new(realm, profile) 50 function new(realm, profile)
51 local mechanisms = {}; 51 local mechanisms = profile.mechanisms;
52 for backend, f in pairs(profile) do 52 if not mechanisms then
53 if backend_mechanism[backend] then 53 mechanisms = {};
54 for _, mechanism in ipairs(backend_mechanism[backend]) do 54 for backend, f in pairs(profile) do
55 mechanisms[mechanism] = true; 55 if backend_mechanism[backend] then
56 for _, mechanism in ipairs(backend_mechanism[backend]) do
57 mechanisms[mechanism] = true;
58 end
56 end 59 end
57 end 60 end
61 profile.mechanisms = mechanisms;
58 end 62 end
59 return setmetatable({ profile = profile, realm = realm, mechs = mechanisms }, method); 63 return setmetatable({ profile = profile, realm = realm, mechs = mechanisms }, method);
60 end 64 end
61 65
62 -- get a fresh clone with the same realm and profile 66 -- get a fresh clone with the same realm and profile

mercurial