Commit Graph

584 Commits

Author SHA1 Message Date
34b21fa917 tests: Port test to use the OutputChecker 2020-12-07 15:27:14 +01:00
2d98d4543f verify: Add print about start for tests
This allows properly reading the output only to the point where we can
ensure that verification has started.
2020-12-07 15:27:14 +01:00
8c46fddd03 verify: Fix verify script to work correctly
The verify script would start an async routine. However, this blocks the
dbus return, which really is needed.

Also, we should only return one item of the script for each VerifyStart
run. So, fix things by pop'ing the first item and putting it on the bus
from a GLib.add_timeout handler.
2020-12-07 15:27:14 +01:00
3a00643d5b tests: Add OutputChecker class to improve test code 2020-12-07 15:27:14 +01:00
eb73e024e1 utils: Fix race in verify accepting unrelated signals
Signals like VerifyResult may be received from unrelated Verify
operations. To avoid races, we need to ignore any VerifyResult that
happenes before the DBus method returns.

The only way to do this race-free is to use the async version of the
VerifyStart method.
2020-12-07 15:27:14 +01:00
a4b06c2219 device: Emit VerifyFingerSelected after the method returned
In order to be race free, clients need to ignore all signals until after
the DBus method to start verification has returned. So the signal must
be emitted later than it currently is.
2020-12-07 15:27:14 +01:00
5ccaa094a0 build: Generate fprintd dbus sources using interactive flags
Since we can't depend on newer GLib yet, we patch the generated sources
to generate some new ones with fixed flags.
2020-12-07 15:14:07 +01:00
fc7e4d0e5c device: Do not require authentication for release/stop
If someone has started an operation, then we don't really need to
confirm they are permitted to stop it again. Not doing this has the
advantage that we cannot run into a second interactive authorization
step accidentally.
2020-12-07 15:14:07 +01:00
583cd870d8 device: Use a common error function if an action is ongoing
There is no need to dupliate the code. Just create one function that
sets an error and returns FALSE if action is not ACTION_NONE.
2020-12-07 12:02:32 +01:00
2ca2d5e62c device: Use a switch to check current action so we can be more selective
For example we were allowing to verify stop while doing other actions
different from enrolling (such as delete or open/close).
2020-12-07 12:02:32 +01:00
c5c81a2ea8 device: Add ACTION_DELETE to prevent concurrent operations
Delete needs to operate on the device, so no other actions are permitted
at the same time. And using the libfprint _sync methods does not
guard against reentrance.
2020-12-07 12:02:32 +01:00
c0ad5880a4 tests: Call VerifyStop in enroll_verify_list_delete test
The test didn't call this and the device would be left in an
inconsistent state, causing an error at shutdown time.
2020-12-07 12:02:32 +01:00
2dc3a4e2c5 device: Use more standard naming for local errors 2020-12-07 12:00:58 +01:00
3b0d93bcc2 tests: Add more authorization tests 2020-12-07 12:00:58 +01:00
eac171ab0f device: Add separate state for delete which will claim internally
Also rename the different claim states to make them a bit more
understandable.
2020-12-07 12:00:58 +01:00
7533f63a06 device: Move permissions checks per DBus invocation in a single function
This way we can avoid repeating the same checks multiple times, and
we have a single point where we check the permissions needed for method
invocation.
2020-12-07 11:59:42 +01:00
a38917ab26 fprintd: Re-order permissions table by priority and add docs
Given that we could do operations where at least one permission, is
requested, we should give more priority to the weaker ones that are
acceptable and in case raise the level at later points.
2020-12-05 01:01:36 +01:00
a92b8e5f60 device: Always return FALSE if setting an error in Check claimed
We may have a case where the sender matches with the
session's sender but have a session invocation already set.

In such case we set an error, but still return TRUE.
2020-12-05 01:01:36 +01:00
29f34cf23c tests/fprintd: Do not hang if we error on name appeared callback
But instead only wait for name to appear and do the tests in the main
function so that we can properly check the exception and depending on
its type skip the test or raise it so that it can be caught by the test
suite
2020-12-04 22:56:37 +01:00
a10f0dc22d net.reactivated.Fprint: Allow actual fprind interfaces to be used
We allowed a non-existant net.reactivated.Fprint interface, while our
interfaces are Manager and Device.

Allow them to be used.
2020-12-03 17:54:21 +01:00
267b322f6d Release 1.90.5 v1.90.5 2020-12-01 14:22:55 +01:00
3b83240e57 tests: Fix detection of non-functional file permissions
If we rely on CI_PROJECT_NAME being set, then the test will fail in
similar environments outside of the fprintd main CI. So just add a
os.stat call afterwards to check whether the permission changes took
effect, and if not, then skip.

So, instead try to create a file and check that this fails.
2020-12-01 14:22:55 +01:00
897cbd341e tests: Skip flaky test_enroll_verify_list_delete test with old libfprint
The test can hang forever unless a fixed libfprint version is used.
2020-12-01 12:46:17 +01:00
9d0305ea05 tests: Use system utils outside of the test environment
The code to pick up the utilities from the test environment would fail
if the environment variables are not set. In that case, we can just use
the binary name and rely on PATH though.
2020-12-01 11:41:11 +01:00
3dbfdabe01 tests: Translate skips into error code 77
This makes the meson output nicer, as it will correctly display that the
test has been skipped. It only happens if all tests in the run were
skipped, but meson always does one test a time.
2020-12-01 10:04:11 +01:00
45cf63d589 tests: Skip hotplug test if "removed" property does not exist
The test requires libfprint 1.90.4 to work, otherwise it will just hang
forever.
2020-12-01 10:04:11 +01:00
29ed88a50a meson: Use warning_level feature of meson
This is nicer than adding -Wall and gives users more control.

Add -Wno-unused-parameter for now as there are lot of places where
this would need to be changed and it is reasonable in most cases.

Add -Wno-pedantic because it conflicts with
g_signal_handlers_disconnect_*
2020-12-01 09:00:55 +00:00
e301779c20 Fix integer signedness mismatches 2020-12-01 09:00:55 +00:00
be5d283a3e device: Remove unused code
The code was left over when adding the function to create the session data.
2020-12-01 09:00:55 +00:00
ebfcbdd13e pam: Use %d with errno instead of %m
Otherwise GCC warns sometimes, and it is easy enough to replace the use
of %m.
2020-12-01 09:00:55 +00:00
ec7376d7e6 meson: Fix CFLAGS use by using add_project_arguments
It seems that meson will not always apply the CFLAGS as defined through
the environment if "c_args=" is used in the default_options array for
the project() call.

Switching to add_project_arguments solves this problem.

See https://github.com/mesonbuild/meson/issues/8037
2020-12-01 09:00:55 +00:00
df568e1ce1 net.reactivated.Fprint: Explicitly allow basic D-Bus APIs 2020-11-28 20:29:57 +00:00
7ee61393ec net.reactivated.Fprint: Only allow clients to send messages with fprintd iface to us
In the way the rule is currently set it would allow clients to send
messages with the fprintd interface to any other service, while we only
allow them to be redirected to fprintd itself.

This was causing a debian linter failure [1].

[1] https://lintian.debian.org/tags/dbus-policy-without-send-destination.html
2020-11-28 20:29:57 +00:00
57ca0dc95e tests/pam: Don't run PAM tests in parallel
Given they could re-use the same pam-wrapper temporary dir, it's better
to avoid running them concurrently.
2020-11-27 19:30:08 +01:00
85ba309e9d tests: Remove pam-wrapper temporary folder on test completion
PAM wrapper creates /tmp/pam.X files during its execution (strictly as
it does not follow $TMPDIR either), however given the low number of
combinations, we may end up in re-using the same pam.* folder during
meson test, causing a failure.

As per this, remove these temporary files on tearDown so that we won't
try reusing the same folder multiple times.
2020-11-27 19:12:06 +01:00
3f2174676e device: Re-define polkit auto-pointer funcs if not defined
In case we're using an old polkit version that does not support
auto-pointers, we need to re-define such functions manually or fprintd
won't compile.

Given that polkit doesn't provide us version informations in headers we
need to get that from pkg-config
2020-11-27 18:21:29 +01:00
5e18d46971 Revert "meson: Bump polkit dependency to 0.114"
We only depend on newer polkit for auto-pointers usage, so it's not
worth to bump its dependency just for them

This reverts commit a8bd2bc25e.
2020-11-27 18:18:51 +01:00
a8bd2bc25e meson: Bump polkit dependency to 0.114
It's the first one supporting auto-pointers
2020-11-27 17:53:58 +01:00
88a627f187 Release 1.90.4 v1.90.4 2020-11-27 14:26:12 +01:00
a8818f9bfb device: Do not disconnect g-authorize-method handler
Disconnecting the g-authorize-method handler is not really needed, as it
is a signal from the same object. This basically reverts 6eb9f263fd
(device: Disconnect authorization callback and remove clients) but keeps
the code to clear known clients in the dispose handler.

Closes: #91
2020-11-27 14:23:41 +01:00
c5a3089f89 device: Remove some debug spew
Closes: #89
2020-11-25 19:09:02 +01:00
5de1261df6 device: Re-fetch session data after synchronous operation
As the mainloop is iterated, the session-data may be modified while the
client vanished handler is running. Re-fetch the session data to avoid
seeing an old state and closing the device a second time.

See: https://gitlab.freedesktop.org/libfprint/fprintd/-/issues/87#note_706357
2020-11-25 19:09:02 +01:00
e5c82d7b96 device: Throw a critical warning if the device was not cleaned up
On finalization, the device should always be cleaned up properly (no
data associated with an action may be left). Show a critical warning if
this is not the case, as it indicates a programming error.
2020-11-25 19:09:02 +01:00
9c842e2c2f manager: Fix leak of FprintDevice reference
When adding a device a reference was leaked.
2020-11-25 19:09:02 +01:00
ec5cce083c device: Fix leaks on device finalization 2020-11-25 19:09:02 +01:00
ab8118bde2 tests: Add device removal test 2020-11-25 19:09:00 +01:00
08fb209aed manager: Fix unexport of removed devices
The correct way to unexport the object again is to unexported it on the
manager rather than on the interface skeleton. This fixes notifications
about device removal on DBus.
2020-11-25 19:08:20 +01:00
6eb9f263fd device: Disconnect authorization callback and remove clients
Add a dispose function to disconnect the authorization callback and
remove all clients (i.e. unwatch their bus names) before destroying the
hash table.
2020-11-25 19:08:20 +01:00
74d05e7996 device: Destroy auth object in finalize 2020-11-25 19:08:20 +01:00
83cd09ba2f device: Unwatch names when removing them
If a device is unplugged/destroyed while a client is using it, then we
would still end up watching the name. The vanish notification will then
access the destroyed FprintDevice object.

Fix this by unwatching the bus name when removing the client entry from
the dictionary.
2020-11-25 19:08:20 +01:00