mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
device: Do not list invalid prints as enrolled
The user may have some invalid prints saved (like the ones enrolled with fprintd 1) in the storage, this lead to list such prints as enrolled but they're actually not valid. So load the prints to ensure that those are of the valid type instead of just discovering them. We may make just store.discover_prints to be aware of this, but this would break some assumptions we do in tests, so better to go this way.
This commit is contained in:
@ -1265,6 +1265,15 @@ class FPrintdVirtualDeviceTest(FPrintdVirtualDeviceBaseTest):
|
||||
with self.assertFprintError('NoEnrolledPrints'):
|
||||
self.device.ListEnrolledFingers('(s)', 'testuser')
|
||||
|
||||
def test_unclaimed_list_enrolled_fingers_ignores_invalid(self):
|
||||
print_path = self.get_print_file_path('testuser', FPrint.Finger.LEFT_INDEX)
|
||||
os.makedirs(os.path.dirname(print_path), exist_ok=True)
|
||||
with open(print_path, mode='wb') as new_print_file:
|
||||
new_print_file.write(b'I am an invalid print!')
|
||||
|
||||
with self.assertFprintError('NoEnrolledPrints'):
|
||||
self.device.ListEnrolledFingers('(s)', 'testuser')
|
||||
|
||||
def test_claim_device_open_fail(self):
|
||||
os.rename(self.tmpdir, self.tmpdir + '-moved')
|
||||
self.addCleanup(os.rename, self.tmpdir + '-moved', self.tmpdir)
|
||||
|
||||
Reference in New Issue
Block a user