81 end |
81 end |
82 end |
82 end |
83 |
83 |
84 -- create a new SASL object which can be used to authenticate clients |
84 -- create a new SASL object which can be used to authenticate clients |
85 function new(realm, profile, forbidden) |
85 function new(realm, profile, forbidden) |
86 sasl_i = {profile = profile}; |
86 local sasl_i = {profile = profile}; |
87 sasl_i.realm = realm; |
87 sasl_i.realm = realm; |
88 s = setmetatable(sasl_i, method); |
88 local s = setmetatable(sasl_i, method); |
89 s:forbidden(sasl_i, forbidden) |
89 if forbidden == nil then forbidden = {} end |
|
90 s:forbidden(forbidden) |
90 return s; |
91 return s; |
91 end |
92 end |
92 |
93 |
93 -- get a fresh clone with the same realm, profiles and forbidden mechanisms |
94 -- get a fresh clone with the same realm, profiles and forbidden mechanisms |
94 function method:clean_clone() |
95 function method:clean_clone() |
110 function method:mechanisms() |
111 function method:mechanisms() |
111 local mechanisms = {} |
112 local mechanisms = {} |
112 for backend, f in pairs(self.profile) do |
113 for backend, f in pairs(self.profile) do |
113 if backend_mechanism[backend] then |
114 if backend_mechanism[backend] then |
114 for _, mechanism in ipairs(backend_mechanism[backend]) do |
115 for _, mechanism in ipairs(backend_mechanism[backend]) do |
115 if not sasl_i.restrict:contains(mechanism) then |
116 if not self.restrict:contains(mechanism) then |
116 mechanisms[mechanism] = true; |
117 mechanisms[mechanism] = true; |
117 end |
118 end |
118 end |
119 end |
119 end |
120 end |
120 end |
121 end |