mod_auth_pam/mod_auth_pam.lua
changeset 1538 57bb2497fadc
parent 1165 b8762c9fb270
child 1593 3e4d15ae2133
equal deleted inserted replaced
1537:88e0b4bace88 1538:57bb2497fadc
    13 end
    13 end
    14 
    14 
    15 function test_password(username, password)
    15 function test_password(username, password)
    16 	local h, err = pam.start("xmpp", username, {
    16 	local h, err = pam.start("xmpp", username, {
    17 		function (t)
    17 		function (t)
    18 			if #t == 1 and t[1][1] == pam.PAM_PROMPT_ECHO_OFF then
    18 			if #t == 1 and t[1][1] == pam.PROMPT_ECHO_OFF then
    19 				return { { password, 0} };
    19 				return { { password, 0} };
    20 			end
    20 			end
    21 		end
    21 		end
    22 	});
    22 	});
    23 	if h and h:authenticate() and h:endx(pam.PAM_SUCCESS) then
    23 	if h and h:authenticate() and h:endx(pam.SUCCESS) then
    24 		return true, true;
    24 		return user_exists(username), true;
    25 	end
    25 	end
    26 	return nil, true;
    26 	return nil, true;
    27 end
    27 end
    28 
    28 
    29 function get_sasl_handler()
    29 function get_sasl_handler()