Software /
code /
prosody
Comparison
util/sasl.lua @ 3550:5e5d136d9de0
util.sasl, util.sasl_cyrus: Mechanism selection cleaned up to be more consistent.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 02 Nov 2010 18:58:11 +0500 |
parent | 3549:395d5bb5266e |
child | 3986:671a660b20f9 |
child | 5829:40c16475194e |
comparison
equal
deleted
inserted
replaced
3549:395d5bb5266e | 3550:5e5d136d9de0 |
---|---|
69 return self.mechs; | 69 return self.mechs; |
70 end | 70 end |
71 | 71 |
72 -- select a mechanism to use | 72 -- select a mechanism to use |
73 function method:select(mechanism) | 73 function method:select(mechanism) |
74 if self.mech_i then | 74 if not self.selected and self.mechs[mechanism] then |
75 return false; | 75 self.selected = mechanism; |
76 return true; | |
76 end | 77 end |
77 | |
78 self.mech_i = mechanisms[self:mechanisms()[mechanism] and mechanism]; | |
79 return (self.mech_i ~= nil); | |
80 end | 78 end |
81 | 79 |
82 -- feed new messages to process into the library | 80 -- feed new messages to process into the library |
83 function method:process(message) | 81 function method:process(message) |
84 --if message == "" or message == nil then return "failure", "malformed-request" end | 82 --if message == "" or message == nil then return "failure", "malformed-request" end |
85 return self.mech_i(self, message); | 83 return mechanisms[self.selected](self, message); |
86 end | 84 end |
87 | 85 |
88 -- load the mechanisms | 86 -- load the mechanisms |
89 require "util.sasl.plain" .init(registerMechanism); | 87 require "util.sasl.plain" .init(registerMechanism); |
90 require "util.sasl.digest-md5".init(registerMechanism); | 88 require "util.sasl.digest-md5".init(registerMechanism); |