Software /
code /
prosody
Comparison
util/sasl_cyrus.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 | 5000:58c9519dc461 |
comparison
equal
deleted
inserted
replaced
3549:395d5bb5266e | 3550:5e5d136d9de0 |
---|---|
119 return self.mechs; | 119 return self.mechs; |
120 end | 120 end |
121 | 121 |
122 -- select a mechanism to use | 122 -- select a mechanism to use |
123 function method:select(mechanism) | 123 function method:select(mechanism) |
124 self.mechanism = mechanism; | 124 if not self.selected and self.mechs[mechanism] then |
125 return self:mechanisms()[mechanism]; | 125 self.selected = mechanism; |
126 return true; | |
127 end | |
126 end | 128 end |
127 | 129 |
128 -- feed new messages to process into the library | 130 -- feed new messages to process into the library |
129 function method:process(message) | 131 function method:process(message) |
130 local err; | 132 local err; |
131 local data; | 133 local data; |
132 | 134 |
133 if not self.first_step_done then | 135 if not self.first_step_done then |
134 err, data = cyrussasl.server_start(self.cyrus, self.mechanism, message or "") | 136 err, data = cyrussasl.server_start(self.cyrus, self.selected, message or "") |
135 self.first_step_done = true; | 137 self.first_step_done = true; |
136 else | 138 else |
137 err, data = cyrussasl.server_step(self.cyrus, message or "") | 139 err, data = cyrussasl.server_step(self.cyrus, message or "") |
138 end | 140 end |
139 | 141 |