util/sasl.lua

branch
sasl
changeset 2177
d5cd6a868959
parent 2176
8de2f7f5b870
child 2178
27c7d287345e
equal deleted inserted replaced
2176:8de2f7f5b870 2177:d5cd6a868959
114 if message == "" or message == nil then return "failure", "malformed-request" end 114 if message == "" or message == nil then return "failure", "malformed-request" end
115 return self.mech_i(self, message); 115 return self.mech_i(self, message);
116 end 116 end
117 117
118 --========================= 118 --=========================
119 --SASL PLAIN 119 --SASL PLAIN according to RFC 4616
120 local function sasl_mechanism_plain(self, message) 120 local function sasl_mechanism_plain(self, message)
121 local response = message 121 local response = message
122 local authorization = s_match(response, "([^%z]+)") 122 local authorization = s_match(response, "([^%z]+)")
123 local authentication = s_match(response, "%z([^%z]+)%z") 123 local authentication = s_match(response, "%z([^%z]+)%z")
124 local password = s_match(response, "%z[^%z]+%z([^%z]+)") 124 local password = s_match(response, "%z[^%z]+%z([^%z]+)")
147 return "failure", "not-authorized"; 147 return "failure", "not-authorized";
148 end 148 end
149 end 149 end
150 registerMechanism("PLAIN", {"plain", "plain_test"}, sasl_mechanism_plain); 150 registerMechanism("PLAIN", {"plain", "plain_test"}, sasl_mechanism_plain);
151 151
152 --=========================
153 --SASL DIGEST-MD5
152 return _M; 154 return _M;

mercurial