Commit graph

730 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
084e5bfafd tests/dbusmock/polkitd: Remove unwanted method, from a fprintd copy-paste 2021-03-23 19:00:33 +01:00
Marco Trevisan (Treviño)
d53eaa7d89 tests/dbusmock/polkitd: Do not look for mock object again
We already get it as the parameter of the load function, so no need
to find it
2021-03-23 19:00:23 +01:00
Marco Trevisan (Treviño)
29a83ec49a tests/dbusmock/fprintd: Do not redefine device object methods multiple times
They will picked anyways by python dbusmock
2021-03-23 18:59:22 +01:00
Marco Trevisan (Treviño)
a5ff42394e main: De-init the storage when main loop is over 2021-03-03 19:51:07 +01:00
Marco Trevisan (Treviño)
0af8cf1d56 tests/fprintd: Use intermediate timeouts based on default setup 2021-03-03 19:51:07 +01:00
Marco Trevisan (Treviño)
3a05589685 utils/delete: Add ability to delete single user fingerprints by finger name
Each user can now be followed by an `-f`/`--finger` parameter that when
available will be used to delete a single fingerprint for the user.

Add tests
2021-03-03 19:51:07 +01:00
Marco Trevisan (Treviño)
8485985ed3 delete: Use GOptionContext to handle help 2021-03-03 19:50:44 +01:00
Marco Trevisan (Treviño)
bb722a0373 tests/fprintd: Add tests for 'verify' utility 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
022ee1a4c5 tests/fprintd: Add test for the enroll utility using virtual device commands 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
8d14af379f utils/verify: Terminate with EXIT_FAILURE when enrollment failed 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
9a13293818 utils/enroll: Terminate with EXIT_FAILURE when enrollment failed 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
c66d5d0fa6 utils/enroll: Fix typo on error 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
aba0f0a714 tests/fprintd: Add test for device error during Claim 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
b1a218d56a tests/fprintd: Add tests to check errors when using the 'delete' tool 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
59c2dc5df2 tests/fprintd: Use output checker in FPrintdUtilsTest 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
f4d2e905bd tests/fprintd: Use storage device for more tests
It's quicker to use for various operations, so better to use it
2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
6f355797f8 device: Throw a NoEnrolledPrints error if trying to delete a device with no prints
Adjust tests accordingly
2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
4b246d3ce2 utils/delete: Use proper error string on deletion 2021-03-03 19:49:07 +01:00
Marco Trevisan (Treviño)
8da1b5e7f5 device: Do not set the device in verification state if we've errored
During VerifyStart we may return early if there are no enrolled prints.
In such case we don't require the verification to be stopped if we're
using identification, but in the verification case we may leave the
device into the verification state.

So ensure we only set the device current state only when we're about to
start it.

Add tests ensuring those cases
2021-03-02 17:15:14 +01:00
Marco Trevisan (Treviño)
6d21128b89 device: Simplify VerifyStart handler using prints loading functions 2021-03-02 17:15:14 +01:00
Marco Trevisan (Treviño)
1511eb93ea 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.
2021-03-02 17:15:14 +01:00
Marco Trevisan (Treviño)
8f3b48e261 device: Add utility function to load all user prints
We may want to be able to load the user prints to check whether they
are usable, so add an utility function for this.

And use it also in load_all_prints().
2021-03-02 17:15:14 +01:00
Benjamin Berg
bc8ff3e3f6 device: Add helper routine to load all prints
It might make sense to push this into the storage layer. But, overall,
it is OK to live here, and if we do make changes on the storage layer we
probably want to change more than just this.
2021-03-02 17:15:14 +01:00
Marco Trevisan (Treviño)
d07e81acae meson: Consider the 'pam' option in the summary
We may show that we build it even when it's disabled but available in
the system
2021-03-02 17:15:14 +01:00
Marco Trevisan (Treviño)
a04a60cd8e tests/fprintd: Add better tests for ListEnrolledFingers in unclaimed state 2021-03-02 17:15:14 +01:00
Marco Trevisan (Treviño)
ecf6b7c323 pam_fprintd: Just return a PAM_AUTH_ERROR on unknown errors
If something under the hood failed with a generic device error we'd just
mark the PAM module not available, this is probably too much as it may
just be due to a device temporary error.

So make it stop but allow the loading system to retry with it
2021-03-02 17:15:14 +01:00
Marco Trevisan (Treviño)
df6ebefef7 pam_fprintd: Consistently return PAM_AUTHINFO_UNAVAIL when device has no prints
Loading saved prints may lead to an error if they were stored long time
ago and so they're using a wrong format.

In such case we list the prints as available even though they are really
not, so the PAM module won't return PAM_AUTHINFO_UNAVAIL as in the
no-prints case but PAM_USER_UNKNOWN.

This will lead some auth systems (such as gdm) to keep retrying using
PAM fprintd module, even if it's not really available.
2021-03-02 17:15:14 +01:00
Benjamin Berg
b7aa0c455d tests: Update output checker
This pulls in some changes done in gnome-settings-daemon to be able to
force close the FD at the end of the test.
2021-02-15 17:45:08 +01:00
Marco Trevisan (Treviño)
fe95889f2e pam_fprintd.pod: Adapt documentation on max-tries to match code 2021-02-01 18:08:25 +01:00
Marco Trevisan (Treviño)
556f8928a6 pam: Allow values bigger than 9 to be used as max tries match 2021-02-01 18:07:52 +01:00
Marco Trevisan (Treviño)
02bd36d8d9 tests/fprintd: Check that we can't try to release a device while closing 2021-01-27 18:18:57 +01:00
Marco Trevisan (Treviño)
b92f39be3d tests/fprintd: Add test to check errors during release 2021-01-27 18:18:57 +01:00
Marco Trevisan (Treviño)
b46aba6fb2 tests/fprintd: Ensure stored print deletion error has higher prio than device error 2021-01-27 18:18:57 +01:00
Marco Trevisan (Treviño)
2b81184b42 device: Fail with any non-zero return value on storage print_data_save()
When saving the prints we use g_file_set_contents under the hood and in
case return its error code that is a positive value.

So in such case we don't fail if we have a write failure at the end of
the enrollment.

While we could ensure in file storage to always return a negative value,
it's always better to ensure that is has to be 0 when we didn't get an
error.

Add a test checking for this case.
2021-01-27 17:52:05 +01:00
Marco Trevisan (Treviño)
2af0e6407a tests/fprintd: Make prints not writable by turning them into directories
Given that the storage will use unlink to delete them, we'll just fail
while writing them, in this way we'll be able to run such tests also in
CI.
2021-01-27 17:52:05 +01:00
Marco Trevisan (Treviño)
9a39f1fde8 tests/fprintd: Verify the case we can't delete prints from device 2021-01-27 17:52:05 +01:00
Marco Trevisan (Treviño)
1deb1e2044 tests/fprintd: Add ability to force-kill the daemon if we're fine to hang 2021-01-27 15:55:48 +01:00
Marco Trevisan (Treviño)
75989bd2be tests/fprintd: Compute timeout for daemon-stop phase depending on platform 2021-01-26 20:52:29 +01:00
Marco Trevisan (Treviño)
3df730faeb tests/fprintd: Make possible to store duplicated prints for an user
Since we so far we had no duplicated-check for prints in fprintd an user
may have enrolled the same print for multiple accounts or even for
different fingers, so we need to simulate this case.

Given that fprintd may not allow to enroll duplicated prints soon, it's
better to just copy the storage value so that we simulate a duplicated
enrollment in the past.
2021-01-26 20:52:29 +01:00
Marco Trevisan (Treviño)
f2514f43f6 tests/fprintd: Return more data about the enrolled prints
It may be useful to be able to associate them to their user
2021-01-26 20:52:29 +01:00
Marco Trevisan (Treviño)
8ef255a3bd tests/fprintd: Add option to claim device for user on enroll_image 2021-01-26 20:52:29 +01:00
Marco Trevisan (Treviño)
15b41aa7c2 tests/fprintd: Add function and tests to enroll multiple users fingers/images
Allow to enroll multiple data in a single shot so that we don't have to
do it for each user, and add a test that uses it to match each possible
combination.
2021-01-26 20:52:29 +01:00
Marco Trevisan (Treviño)
bec42959ad tests/fprintd: Add an utility function to easily check for match/no-match 2021-01-26 20:52:29 +01:00
Marco Trevisan (Treviño)
5e00b01cf1 tests/fprintd: Ensure that the selected finger is emitted as expected 2021-01-26 19:41:53 +01:00
Marco Trevisan (Treviño)
b3bf4ac1a3 tests/fprintd: Unset the values we monitor for results on wait_for_result
We need to ensure those assume the value we want after waiting
2021-01-26 19:41:48 +01:00
Marco Trevisan (Treviño)
4aa70fb6c6 tests/fprintd: Reimplement the tests relying on specific image driver features
Some tests were delaying VerifyStop by not reporting the finger status
in the image driver, we can do the same using sleeps in the virtual
device driver, so let's reimplement such calls
2021-01-26 16:56:31 +01:00
Marco Trevisan (Treviño)
d2c8a383e6 tests/fprintd: Implement device removal via the 'UNPLUG' command 2021-01-26 04:38:09 +01:00
Marco Trevisan (Treviño)
9a85bfa57f tests/fprintd: Ensure the scan type can be changed and is notified 2021-01-25 19:50:46 +01:00
Marco Trevisan (Treviño)
7f2133cc79 tests/fprintd: Verify using no-identification device with 'any' finger 2021-01-25 19:50:46 +01:00
Marco Trevisan (Treviño)
8491d35eef tests/fprintd: Verify that we can enroll with one stage only 2021-01-25 19:50:46 +01:00