Comparison

plugins/sasl.lua @ 358:a8f6fd6a70ed

plugins.sasl: Alter mechanism loading and pass name of loaded mechanism. Fixes attempting SCRAM-PLUS when only SCRAM is offered
author Kim Alvefur <zash@zash.se>
date Thu, 18 Sep 2014 20:32:38 +0200
parent 354:58cd27b74ba5
child 360:ac3940bad1bf
comparison
equal deleted inserted replaced
357:ed12e00991b1 358:a8f6fd6a70ed
18 if not mechanisms[mech] then 18 if not mechanisms[mech] then
19 local name = mech:match("[^-]+"); 19 local name = mech:match("[^-]+");
20 local ok, impl = pcall(require, "util.sasl."..name:lower()); 20 local ok, impl = pcall(require, "util.sasl."..name:lower());
21 if ok then 21 if ok then
22 stream:debug("Loaded SASL %s module", name); 22 stream:debug("Loaded SASL %s module", name);
23 impl(stream, mechanisms, preference); 23 mechanisms[name], preference[name] = impl(stream, name);
24 elseif not tostring(impl):match("not found") then 24 elseif not tostring(impl):match("not found") then
25 stream:debug("Loading failed: %s", tostring(impl)); 25 stream:debug("Loading failed: %s", tostring(impl));
26 end 26 end
27 end 27 end
28 end 28 end