Commit Graph

315 Commits

Author SHA1 Message Date
d70f15b5e8 pam: Port to sd-bus
This pam plugin never used GDBus because it transparently uses threads
which do not work well with a lot of PAM applications. But even settling
on the "still better to use than plain dbus library" dbus-glib wasn't
without problems, as any use or initialisation of GIO sockets would
modify signal handler for signals such as SIGPIPE (see gio/gsocket.c).

Many years later, sd-bus is a more modern alternative to the bare dbus
library with a better API.

This includes:
- Removing use of gboolean, guint, g_new0() and many glib string helpers
- Simplifying debug logging
- Marking user-facing messages to be translated
2020-01-24 00:51:13 +01:00
6f63beb1fc pam: Add str_has_prefix() helper
To simplify the options parsing.
2020-01-23 18:45:43 +01:00
f7557c6ee7 pam: Add monotonic clock helper 2020-01-23 18:45:43 +01:00
0b598965b0 pam: Remove GLib usage from copy/paste header 2020-01-23 18:45:43 +01:00
8325d347d6 pam: Add str_equal() helper to copy/paste header 2020-01-23 18:45:43 +01:00
0bdf801043 pam: Add helper to replace G_GNUC_UNUSED to copy/paste header 2020-01-23 18:45:43 +01:00
6e3b053372 pam: Add include for bool to copy/paste header 2020-01-23 18:45:43 +01:00
c6e72c5f28 pam: Add include for asprintf to copy/paste header 2020-01-23 18:45:43 +01:00
986a42bcd1 pam: Update copyright notice 2020-01-23 18:45:43 +01:00
0c6bab8640 main: Fix redeclaration linking error
Fix linking error as the "store" global variable gets redeclared in
each C file that includes the header. Move the actual declaration to
main.c.

Fixes:
 /usr/bin/ld: ./.libs/libfprintd.a(device.o):/builds/libfprint/fprintd/src/storage.h:51: multiple definition of `store'; main.o:/builds/libfprint/fprintd/src/storage.h:51: first defined here
2020-01-23 18:25:25 +01:00
b99afd19f0 main: Use #pragma once 2020-01-23 18:25:18 +01:00
3d6dfabd8d Revert "ci: Temporarily add newer pam_wrapper build"
This reverts commit db0ab55bef.
2020-01-23 18:25:14 +01:00
67adcb59ed configure.ac: Depend on libfprint-2
libfprint changed SONAME to completely break with previous version, so
update fprintd dependency accordingly.
2020-01-23 18:24:53 +01:00
db0ab55bef ci: Temporarily add newer pam_wrapper build
So that the test suite can pass.
2020-01-22 15:34:02 +01:00
00b79d1a2f tests: Add test for the PAM module
Test the PAM module using pam_wrapper and our mock fprintd.

See https://lwn.net/Articles/671094/

Note that this requires a version of pam_wrapper with this bug fixed:
https://bugzilla.samba.org/show_bug.cgi?id=14245
2020-01-22 15:34:02 +01:00
f1517af09a tests: Add fprintd-verify test that uses scripting 2020-01-20 17:31:46 +01:00
c0bf1515fd tests: Check that verify test doesn't succeed early 2020-01-20 17:31:08 +01:00
872089883c tests: Add scripting capabilities to the verification process
Add scripting capabilities to the verification process so that the mock
daemon can send its own results without needing the client to prod it to
do that. This is incredibly useful when the client is single threaded
and blocking.

Note that there are barely any safeguards, so the scripting task is not
cancelled if an error occurs, or the VerifyStatus signals are sent out
of order.
2020-01-20 17:26:24 +01:00
431755becd tests: Add test for fprintd utils 2020-01-17 15:32:22 +01:00
0a42b90390 tests: Add dbusmock template for fprintd daemon 2020-01-17 15:18:43 +01:00
cd3ed2e450 device: Fix documentation for ERROR_INVALID_FINGERNAME 2020-01-17 14:41:22 +01:00
c929d39df1 device: Fix "enrollemnt" typo 2020-01-17 14:40:36 +01:00
1a5ef6c5a7 build: Add separate dependency for pam module 2020-01-14 15:52:21 +01:00
ce3406b20f main: Fix typos in comments 2020-01-14 14:00:56 +01:00
0d407db171 manager: Fix typo in comment 2020-01-14 14:00:56 +01:00
4eb751a218 data: Fix typos in man pages 2020-01-14 14:00:56 +01:00
0f44267ea1 README.transifex: Fix typo 2020-01-14 14:00:56 +01:00
9baea4494b device: Replace deprecated g_type_class_add_private() 2020-01-14 14:00:56 +01:00
41afbd1ced device: Simplify FprintDevicePrivate declaration 2020-01-14 14:00:56 +01:00
f2d6921b74 manager: Replace deprecated g_type_class_add_private() 2020-01-14 14:00:56 +01:00
b690daa95f all: Call setlocale() at the start of main()
This fixes some broken characters in the fprintd debug output.
2020-01-14 13:51:46 +01:00
deb3c25e51 device: Adjust to new libfprint API for early match reporting
This API was added to libfprint to allow drivers to report the match
result early before the operation has been completed. No driver makes
use of this facility yet and instead drivers try to finish the
operation early for quick result reporting. This primarily means not
waiting for finger removal.

Once drivers are updated, fprintd reactivity will regress unless the
early match callback is implemented as they would only get an operation
finished callback when the whole of the operation was finished,
including finger removal and finishing up USB communications.

See: https://gitlab.freedesktop.org/libfprint/fprintd/issues/35
2020-01-14 13:41:57 +01:00
a520896325 device: Use FP_FINGER_IS_VALID to check finger number 2019-12-19 14:29:04 +01:00
707ed01059 file_storage: Remove definition of FP_FINGER_IS_VALID
This is now provided by libfprint
2019-12-19 14:28:35 +01:00
6903c36157 file-storage: Use first/last fingers references instead of named ones
Don't depend in the hardcoded libfprint fingers order, but use instead the
aliases for first/last fingers in libfprint order
2019-12-18 17:34:04 +01:00
d0df422f9b all: Bump required glib version
Require the same version of glib as libfprint, and remove support for
very old versions.
2019-12-18 17:03:37 +01:00
882740f8a1 utils: Use new print deletion API
Use the new API that works by claiming the device and then deleting the
prints.

Fixes: #26
2019-12-05 17:54:21 +01:00
5043ef3c7d device: Print warnings for fatal errors 2019-12-04 17:03:53 +01:00
cdd79a0935 ci: Remove libfprint dependencies that are not needed
The dependency list of libfprint used to be a direct copy of the
libfprint CI list. However, many of the dependencies are not needed as
only a minimal version of libfprint is built for testing purposes.
2019-12-03 17:08:04 +01:00
776b4f4cec device: Log offending API user if DeleteEnrolledFinger is used
When the DeleteEnrolledFinger API is used, log an additional warning
with the command that made the call.
2019-12-03 17:08:04 +01:00
31bfd1b055 ci: Run make check in the test stage 2019-12-03 17:08:04 +01:00
74838f9efc tests: Add basic integration test
This test uses the virtual image driver included in libfprint for
testing.
2019-12-03 17:08:04 +01:00
54ba81191e tests: Add test prints from libfprint
These can be freely redistributed as they are in the public domain. See
the included README.
2019-12-03 17:08:03 +01:00
521ba9b124 storage: Use $STATE_DIRECTORY when available
The state directory will generally be the same as the hardcoded one.
However, being able to override it is important for testing purposes, so
add the option.
2019-12-03 17:08:03 +01:00
3db69c2c2f utils: Move test binaries into utils
These utilities are generally useful beyond only testing purproses. And,
since it is desirable to have automated tests inside the tests
subdirecty, it makes sense to move them elsewhere.
2019-12-03 17:08:03 +01:00
b2ff316e20 device: Add new API and fallback to delete prints from device
Some devices require storing the print on the device, to support this,
try deleting prints from the device before deleting them from local
storage.

To handle these devices, add a new API that requires the device to be
claimed rather than allowing deletion without claiming the device first.
Also add appropriate fallbacks so that the old API will continue to
work, but warn about its use.
2019-12-03 17:08:03 +01:00
94f54c0638 main: Register the common name after initializing the manager
When creating the FprintManager object the devices will be enumerated.
This operation calls the mainloop recursively. We do not want to receive
any client requests before the initial enumeration has happened. Because
of this, move the registration of the common name to happen after the
enumeration has finished.
2019-12-03 17:08:03 +01:00
9c8d062669 device: Handle full device storage including garbage collection
The new libfprint version has support for devices that store data on the
sensor. In that case, the on-sensor storage might fill up when the user
tries to enroll a new print.

The strategy introduced here to handle this is to try and delete prints
from the device that we do not know about (assuming, it is e.g. from an
old installation and unusable).

It can also happen that we are not able to garbage collect old prints.
If that happens, a new error code "enroll-data-full" will be returned
signalling the situation to the enrolling application.
2019-12-03 17:08:03 +01:00
ca482036c7 storage: Add function to discover users that have prints
For sensors with internal storage we may want to garbage collect prints.
Adding this API means we can list all local prints, allowing us to find
out whether there are prints on the device's storage with no
corresponding print on the host.
2019-12-03 17:08:03 +01:00
d7821aa790 Initial port to libfprint2 2019-12-03 17:08:03 +01:00