Comparison

util/sasl.lua @ 2873:108ed17f1dd9

util.sasl.plain: Allow empty authzid (thanks bjc).
author Waqas Hussain <waqas20@gmail.com>
date Tue, 01 Dec 2009 22:32:37 +0500
parent 2088:5a9dc066a388
child 2923:b7049746bd29
comparison
equal deleted inserted replaced
2872:cdc292d201fc 2873:108ed17f1dd9
36 local function new_plain(realm, credentials_handler) 36 local function new_plain(realm, credentials_handler)
37 local object = { mechanism = "PLAIN", realm = realm, credentials_handler = credentials_handler} 37 local object = { mechanism = "PLAIN", realm = realm, credentials_handler = credentials_handler}
38 function object.feed(self, message) 38 function object.feed(self, message)
39 if message == "" or message == nil then return "failure", "malformed-request" end 39 if message == "" or message == nil then return "failure", "malformed-request" end
40 local response = message 40 local response = message
41 local authorization = s_match(response, "([^%z]+)") 41 local authorization = s_match(response, "([^%z]*)")
42 local authentication = s_match(response, "%z([^%z]+)%z") 42 local authentication = s_match(response, "%z([^%z]+)%z")
43 local password = s_match(response, "%z[^%z]+%z([^%z]+)") 43 local password = s_match(response, "%z[^%z]+%z([^%z]+)")
44 44
45 if authentication == nil or password == nil then return "failure", "malformed-request" end 45 if authentication == nil or password == nil then return "failure", "malformed-request" end
46 self.username = authentication 46 self.username = authentication