pam: Return PAM_MAXTRIES after too many tries

This commit is contained in:
Bastien Nocera
2020-01-24 00:38:04 +01:00
parent 6ab270fb1a
commit affffaf134
2 changed files with 5 additions and 1 deletions

View File

@ -433,6 +433,9 @@ do_verify (pam_handle_t *pamh,
data->max_tries--; data->max_tries--;
} }
if (data->max_tries == 0)
ret = PAM_MAXTRIES;
sd_bus_slot_unref (verify_status_slot); sd_bus_slot_unref (verify_status_slot);
sd_bus_slot_unref (verify_finger_selected_slot); sd_bus_slot_unref (verify_finger_selected_slot);

View File

@ -29,6 +29,7 @@ PAM_SUCCESS = 0
PAM_AUTH_ERR = 7 PAM_AUTH_ERR = 7
PAM_AUTHINFO_UNAVAIL = 9 PAM_AUTHINFO_UNAVAIL = 9
PAM_USER_UNKNOWN = 10 PAM_USER_UNKNOWN = 10
PAM_MAXTRIES = 11
class TestPamFprintd(dbusmock.DBusTestCase): class TestPamFprintd(dbusmock.DBusTestCase):
'''Test pam_fprintd''' '''Test pam_fprintd'''
@ -127,7 +128,7 @@ class TestPamFprintd(dbusmock.DBusTestCase):
] ]
self.device_mock.SetVerifyScript(script) self.device_mock.SetVerifyScript(script)
tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rv=PAM_AUTH_ERR) tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rv=PAM_MAXTRIES)
res = pypamtest.run_pamtest("toto", "fprintd-pam-test", [tc], [ 'unused' ]) res = pypamtest.run_pamtest("toto", "fprintd-pam-test", [tc], [ 'unused' ])
self.assertRegex(res.info[0], r'Swipe your left little finger across the fingerprint reader') self.assertRegex(res.info[0], r'Swipe your left little finger across the fingerprint reader')