util/sasl/plain.lua
changeset 2252 98a2bc275e0e
parent 2210 78c9b5255b27
child 2263 ff881b857c98
equal deleted inserted replaced
2251:18079ede5b62 2252:98a2bc275e0e
    19 
    19 
    20 --=========================
    20 --=========================
    21 --SASL PLAIN according to RFC 4616
    21 --SASL PLAIN according to RFC 4616
    22 local function plain(self, message)
    22 local function plain(self, message)
    23 	local response = message
    23 	local response = message
    24 	local authorization = s_match(response, "([^%z]+)")
    24 	
    25 	local authentication = s_match(response, "%z([^%z]+)%z")
    25 	local authorization, authentication, password;
    26 	local password = s_match(response, "%z[^%z]+%z([^%z]+)")
    26 	if response then
    27 
    27 		authorization = s_match(response, "([^%z]+)")
       
    28 		authentication = s_match(response, "%z([^%z]+)%z")
       
    29 		password = s_match(response, "%z[^%z]+%z([^%z]+)")
       
    30 	end
       
    31 	
    28 	if authentication == nil or password == nil then
    32 	if authentication == nil or password == nil then
    29 		return "failure", "malformed-request";
    33 		return "failure", "malformed-request";
    30 	end
    34 	end
    31 	
    35 	
    32 	-- SASLprep password and authentication
    36 	-- SASLprep password and authentication