Commit Graph

797 Commits

Author SHA1 Message Date
584933aad7 pam_fprintd: Fix a few issues found by static analysis
Just dead stores and an ignored return value that we really do not care
about.
2021-01-22 13:16:19 +00:00
eadf4fced8 tests: Add test to verify deletion
This enrolls a few prints, deletes them. Then checks that all the new
prints have been deleted, but all the garbage prints still exist.
2021-01-20 23:25:52 +01:00
27a76c9b79 tests: Add test to check order of garbage collection 2021-01-20 23:25:52 +01:00
9301693c83 tests: Allow use of other virtual devices 2021-01-20 23:25:52 +01:00
00fbf19079 device: Prefer older prints when garbage collecting
This makes garbage collection a bit more predictable overall. Note that
we'll first delete prints that we do not know the age of.

If we cannot sort them by age, then randomize the order so that we don't
end up deleting in the order that the device returned the prints.
2021-01-20 23:25:52 +01:00
6fd1aa51cd data: Use the correct mode for the state dir
The code (in file_storage.c) expects mode 0700. However, systemd
defaults to 0755. This causes strange behavior.

https://bugs.archlinux.org/task/68932
2021-01-19 22:18:55 +00:00
0e428d34ec tests: Make tests executable
This makes it easier to use them in out-of-tree tests.
2021-01-13 14:47:00 +01:00
da60bddb3e Release 1.90.9 v1.90.9 2021-01-13 13:23:24 +01:00
506d99e90c tests: Check that two consecutive runs work 2021-01-11 12:59:06 +00:00
e7f47e28d7 tests: Add finger and connection sharing for virtual image
This allows testing some more conditions (e.g. forcing VerifyStop to run
into a cancellation).
2021-01-11 12:59:06 +00:00
938c1aac5a device: Add common stoppable_action_completed function
The stoppable actions (Verify/Enroll) have the same logic during
completion. Create a common function to share this logic instead of
copying it in each of the handlers.

Fixes: #97
2021-01-11 12:59:06 +00:00
fd02922608 pam: Pick the device with more enrolled finger prints
When multiple devices are available PAM module will just pick the first
one, even if it has not enrolled fingers.

Since this can't be user configured (yet) we can be a bit smarter and
select the device that has more fingerprints configured for the user.
2021-01-05 12:16:09 +00:00
195f7eaf5f tests/fprintd: Check that fingers deletion will remove user print
But will keep state dir where it is
2021-01-05 13:07:19 +01:00
48ea3b89c9 file_storage: Cleanup the user storage path when removing prints
Try to remove user and devices directories if they are empty.
2021-01-05 13:07:19 +01:00
4cfa6b5b37 file_storage: Remove debug leftovers and add actual debug statements 2021-01-05 13:07:19 +01:00
c685f0d34c file_storage: Don't return an error if the print doesn't exist
We may just try to remove something isn't there so it's not an actual
error from our POV.
2021-01-05 13:07:19 +01:00
eece834231 file_storage: Do not remove the finger path two times
Return the actual operation error instead
2021-01-05 13:07:19 +01:00
3faaa81257 file_storage: Do not ignore STATE_DIRECTORY if it's set to an actual path 2021-01-05 13:07:19 +01:00
b9cdb58a1a device: Load the current finger print and not always the first print
In the garbage collection code we always ended up to load the first
enrolled print, and this may lead to removing from device storage prints
that are actually in use.
2021-01-05 12:57:55 +01:00
ab8dcfaa61 treewide: fix typos 2021-01-04 11:04:13 +01:00
25a97c8276 tests: Add disconnect tests for enroll/verify/identify
We test both the scenario where VerifyStop/EnrollStop is not called
while the operation is still ongoing or when the operation is already
finished.
2021-01-04 11:00:18 +01:00
8057e49d31 tests: Allow claiming in secondary bus helper
This saves an extra step when creating tests that disconnect.
2021-01-04 11:00:18 +01:00
f75e800d5c tests: Allow enrolling from different device
This simplfies disconnect tests as we can do the enroll from the client
that will disconnect later on.
2021-01-04 11:00:18 +01:00
6ae4f5e939 tests: Add get_secondary_bus_and_device helper
It returns a new bus object and the device on that bus. This allows
testing what happens if a client disconnects from the bus.
2021-01-04 11:00:18 +01:00
7c9a04c2ae device: Fix race when client vanishes from bus
We have a condition where a client vanishing instead of cleaning up the
operation using VerifyStop would cause fprintd to hang. This only
happens if the underlying enroll/verify/identify operation has already
finished when the client vanishes.

Fix this by correctly interpreting current_cancellable as a flag for
these operations.

Fixes: #97
2021-01-04 11:00:18 +01:00
7b7aa6e99d device: Fix typos 2021-01-04 09:49:24 +08:00
b624f8c8c7 manager: Do not use unnecessary volatile qualifier on GQuark
As per new GLib in CI image fprintd doesn't build anymore, since
g_once_init_enter now warns about using a volatile value, as this has
never been supposed to be the case, despite its signature [1].

Related to: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

[1] https://gitlab.gnome.org/GNOME/glib/-/issues/600
2020-12-19 22:34:12 +01:00
3e81179eca device: Add auto-cleanup function to unset the current action
This is useful in the functions where we have to unset the device's
current action but we may use early-return to handle multiple conditions
such as in open, close and delete functions.
The latest also currently is a bit buggy as it won't reset the state on
some failures.
2020-12-17 16:33:58 +01:00
c6647ba875 tests: Add test that enforces a verify/identify operation restart
In the usual test we cancel the operation immediately by calling
VerifyStop. This (often) tests the case where we don't end up restarting
the Verify operation internally.

We can easily force fprintd to have restarted already internally, so add
a test that does so by sleeping a bit. This should give us a slightly
higher branch coverage in the verify_cb/identify_cb tests.
2020-12-16 14:44:23 +01:00
988ee01f66 tests: Add retry test for PAM 2020-12-16 14:12:37 +01:00
32ee94c8a0 Add compatibility defines to allow compiling with older glib
We need at least the GFlagsClass autoptr, but just pull in most of the
definitions from libfprint.
2020-12-14 11:30:45 +01:00
7d22a2b5b9 Release 1.90.8 v1.90.8 2020-12-11 16:00:28 +01:00
de725a91e4 verify: Print message about verification start from callback
It seems that GLib may process multiple DBus signals in one mainloop
iteration. This could cause messages to be re-ordered, which in turn
caused a race condition in the CI that could trigger random failures.
2020-12-11 16:00:28 +01:00
18392cba54 manager: Export the object manager in /net/reactivated/Fprint
Given we're going to use an object manager it can just stay at the root
of the project, while it will be just used to manage the devices
2020-12-11 15:30:26 +01:00
783d82f359 device: Expose method name when logging authorization steps 2020-12-11 14:03:37 +00:00
c00a3375d1 device: Use standard names for local errors and remove unused one 2020-12-11 14:03:37 +00:00
5aa61adabc build: make systemd dependency optional
The systemd dependency is only used to install some systemd service
files. This can easily be made optional.
2020-12-11 15:01:24 +01:00
1fc10f15ee pam: Stop authorization if we couldn't parse signals
This really should never ever happen. If it does, don't continue but
stop instead.
2020-12-11 10:34:51 +01:00
c24badfd68 pam: Move NameOwnerChanged registration after initialization
We must ignore NameOwnerChanged that happen due to automatic startup.
The easy way to do so is to just register it only when we get to the
point that a name owner change has security implications.

While add it, change it to always log at a warning level.

Fixes: #94
2020-12-11 10:34:51 +01:00
4612c1f3ed Release 1.90.7 v1.90.7 2020-12-09 13:16:12 +01:00
ca216a32af test_pam_fprintd: Add test verifying the case in which we've no devices 2020-12-08 21:14:24 +01:00
944493e472 pam_fprintd: Protect usage of strdup for NULL values
It's not smart as g_strdup, so need to ensure we don't use it for NULL
strings.

This is a regression caused by commit bf223662
2020-12-08 21:14:01 +01:00
34f24cbe19 ci: Move build jobs to build phase 2020-12-07 18:42:24 +01:00
9314069a88 ci: Add check-source stage where we check syntax 2020-12-07 18:42:24 +01:00
66e21eac8f .git-blame-ignore-revs: Ignore formatting commit and add hint how to use it 2020-12-07 18:42:22 +01:00
f73429f062 fprintd: Reindent the source code following uncrustify rules 2020-12-07 18:41:45 +01:00
c18ebaf9da scripts: Add uncrustify scripts for reformatting fprintd source code
We follow libfprint here, using GNOME format
2020-12-07 18:41:45 +01:00
4a80bfacec fingerprint-strings: Make the finger_str_to_msg loop clearer
Just continue earlier instead of using a long if check
2020-12-07 18:41:45 +01:00
52058c1ea0 Release 1.90.6 v1.90.6 2020-12-07 15:34:48 +01:00
22cdc0a7ea device: Always use FpFinger instead of a mixture of it and finger numbers
We already use FpFinger for storage operations and prints management,
but internally we keep still using the old finger number, that uses
different values for invalid data.

Let's be consistent, and always use FpFinger everywhere.
2020-12-07 15:27:14 +01:00