Commit graph

327 commits

Author SHA1 Message Date
Benjamin Berg
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
Benjamin Berg
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
Benjamin Berg
31bfd1b055 ci: Run make check in the test stage 2019-12-03 17:08:04 +01:00
Benjamin Berg
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
Benjamin Berg
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
Benjamin Berg
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
Benjamin Berg
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
Benjamin Berg
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
Benjamin Berg
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
Benjamin Berg
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
Benjamin Berg
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
Benjamin Berg
d7821aa790 Initial port to libfprint2 2019-12-03 17:08:03 +01:00
Benjamin Berg
16cb1a8ec6 device: Use g_clear_pointer in places
Replace some g_free calls with subsequent NULL setting with
g_clear_pointer.
2019-12-02 16:20:01 +01:00
Benjamin Berg
31ba9ebea4 ci: libfprint master is now version two
libfprint master contains version 2 of the library now. This means we
need to add dependencies and change some other things a bit.
2019-12-02 16:19:55 +01:00
Benjamin Berg
8893c2f906 ci: Build against libfprint-1-0
The libfprint master branch will soon contain the v2 API. So change to
use the libfprint-1-0 which will mean that the CI will continue to work.

Note that the build_stable target will need to be removed when the new
libfprint version reaches fedora rawhide.
2019-10-07 16:39:25 +02:00
worldofpeace
3520cb56d1 build: Move D-Bus conf file to $(datadir)/dbus-1/system.d
Since D-Bus 1.9.18 configuration files installed by third-party should
go in share/dbus-1/system.d. The old location is for sysadmin overrides.
2019-09-16 11:43:51 -04:00
Benjamin Berg
96444b4156 pam: Fix rhost string length check 2019-08-13 14:16:32 +02:00
Bastien Nocera
c0ba475fbf 0.9.0 2019-08-08 15:18:00 +02:00
Bastien Nocera
704c19b87a device: Restart verification if error is "retry"
fprintd's API docs say that "retry" errors for verification
"the verification is still ongoing" and that "[the] user should retry
scanning their finger.

Unfortunately, retry errors are fatal in libfprint. Make fprintd restart
operations when "retry" is the error for either identification or
verification purposes.

We need to also make sure that a "*Stop" D-Bus call will return as
normal if called while we're stopping a verification or identification
in order to restart it.

Closes: #22
2019-08-08 13:12:28 +00:00
Bastien Nocera
8f90390c6b pam: Fix rhost check when rhost is unavailable
Don't exit early if the rhost field isn't filled in, as it usually isn't
for a lot of services.

Fixes: 3274a31
2019-08-08 12:31:32 +02:00
Bastien Nocera
e061990fa9 build: Fix loading configuration file with default build args
Fix incorrect configuration path when the sysconfdir is relative to the
prefix argument:
fprintd-WARNING **: 12:22:38.816: Could not open "${prefix}/etc/fprintd.conf": No such file or directory

The path needs to be expanded before it's substituted.
2019-08-08 12:26:23 +02:00
Bastien Nocera
011310e30c main: Print the full path of the configuration file
Rather than just its filename, otherwise we won't know where to look.
2019-08-08 12:26:23 +02:00
Bastien Nocera
3274a31153 pam: Don't ask for fingerprints for remote logins
As written in the "Linux-PAM Application Developers' Guide"
at http://www.linux-pam.org/Linux-PAM-html/adg-security-user-identity.html:
"
As a general rule, the following convention for its value can be
assumed: NULL = unknown; localhost = invoked directly from the
local system; other.place.xyz = some component of the user's
connection originates from this remote/requesting host.
"

So also exit early if the hostname isn't localhost as it should be.

Closes: #21
2019-08-07 14:12:53 +00:00
Bastien Nocera
d6c4e8ba64 file: Remove unused variable 2019-08-07 15:15:23 +02:00
Bastien Nocera
48976d0031 main: Throw g_warning() on startup failure
Rather than using g_print()
2019-08-07 15:15:23 +02:00
Bastien Nocera
cbf4a47af3 main: Add debug when about to load configuration file 2019-08-07 15:15:23 +02:00
Bastien Nocera
bfbac18606 file: More debug on file and directory accesses 2019-08-07 15:15:23 +02:00
Bastien Nocera
09529c396b Add code of conduct document 2019-07-25 12:07:27 +02:00
Will Thompson
94a9815362 data: tell systemd to create state directory
If the directory referred to by ReadWritePaths= does not exist, the
service fails to start:

    systemd[1]: Starting Fingerprint Authentication Daemon...
    systemd[9736]: fprintd.service: Failed to set up mount namespacing: No such file or directory
    systemd[9736]: fprintd.service: Failed at step NAMESPACE spawning /usr/lib/fprintd/fprintd: No such file or directory
    systemd[1]: fprintd.service: Main process exited, code=exited, status=226/NAMESPACE
    systemd[1]: fprintd.service: Failed with result 'exit-code'.
    systemd[1]: Failed to start Fingerprint Authentication Daemon.

This may happen when booting with an empty /var filesystem.

For a system service, "StateDirectory=fprint" causes /var/lib/fprint and
any parent directories to be created if missing (with mode 0755 by
default, owned by the user and group of the service, which in this case
is root).  In combination with ProtectSystem=strict, this state
directory will be mounted read-write.  StateDirectory was introduced in
systemd 235, so require at least this version.

The /var/lib prefix is hardcoded in systemd. (Since systemd 240, the
full path(s) to StateDirectory are provided as $STATE_DIRECTORY, but
since it is always /var/lib, we continue to just hardcode that path.)

On non-systemd systems, since fprintd runs as root with no confinement,
it can create its state directory as needed (with g_mkdir_with_parents()
in file_storage_print_data_save()).
2019-07-04 15:27:54 +01:00
Will Thompson
9ed8767cb3 Hardcode storage path as /var/lib/fprint
--localstatedir (and --prefix) will now be ignored in favour of this
hardcoded path.  This is in preparation for a change to use systemd's
StateDirectory feature.
2019-07-04 15:27:54 +01:00
Will Thompson
8ae7abc6c2 autogen.sh: open-code pushd/popd
This script uses /bin/sh, which on Debian-like systems is dash, which
does not support bash's pushd/popd.
2019-03-21 09:17:43 +00:00
Bastien Nocera
dd9d7cc35d build: Create the storage directory at install time
Otherwise you could get into a state where the daemon could not start
because the directory listed as a ReadWritePaths in the .service file is
missing.

Spotted by Will Thompson.

See: !5
2019-03-04 17:10:13 +01:00
Seong-Joong Kim
dbeeb95756 file: Simplify file_storage_get_basestore_for_username() usage
file_storage_get_basestore_for_username() can never fail, so simplify
its callers by removing the error checking.
2019-02-15 23:59:00 +00:00
Bastien Nocera
5e76441210 ci: Fix CI for recent libfprint changes
The gettext in fprintd would be getting confused by a new file in
libfprint that looks like it should have been translated. Ignore this
file in our build.
2019-02-15 12:19:06 +01:00
Bastien Nocera
8de9164be0 main: Fix memory leak when a save fails
and simplify the flow of that function.

From https://bugs.launchpad.net/ubuntu/+source/fprintd/+bug/1745455/comments/7
2018-11-12 12:09:51 +00:00
Bastien Nocera
267e6b3238 device: Fix client_username memory leak
No need to duplicate that string until we pass it out.

From https://bugs.launchpad.net/ubuntu/+source/fprintd/+bug/1745455/comments/7
2018-11-12 12:09:51 +00:00
Corentin Noël
51f4dce4e7 pam: Fix typo in occurred 2018-11-09 07:41:42 +01:00
Bastien Nocera
0c76397a6e loop: Use signed type for fp_get_pollfds() retval
This will be a warning with slightly older versions of libfprint, but at
least it would catch errors.
2018-06-26 15:19:45 +02:00
Bastien Nocera
815256717b README: Update URL in Transifex doc 2018-06-18 12:45:41 +02:00
Bastien Nocera
9e32cd5257 0.8.1 2018-06-15 17:54:01 +02:00
Bastien Nocera
32b9f1b056 data: Update policy vendor URL 2018-06-15 17:54:01 +02:00
Bastien Nocera
12ef09a1c9 po: Update translations 2018-06-15 17:50:08 +02:00
Bastien Nocera
596172e42d README: Update link to website 2018-06-07 22:25:39 +02:00
Bastien Nocera
d37d8a233a TODO: Remove image transfer support
I doubt we want to do this, and nothing has needed it so far.
2018-05-31 17:28:19 +02:00
Bastien Nocera
3550ac5f05 TODO: Remove identification support TODO
See #10
2018-05-31 17:28:19 +02:00
Bastien Nocera
111681c57d TODO: Remove hardware protection TODO
See #9
2018-05-31 17:24:58 +02:00
Bastien Nocera
6eed9f1244 TODO: Remove translations from TODO
Already registered in Transifex:
https://www.transifex.com/freedesktop/fprintd/
2018-05-31 17:23:53 +02:00
Bastien Nocera
04bd6bab46 TODO: Remove hotplug TODO item
See #8
2018-05-31 17:20:19 +02:00
Bastien Nocera
fa4af3ee67 build: Add CI 2018-05-31 14:44:17 +02:00
Bastien Nocera
31b985f547 device: Fix crash on exit
Fix a possible crash when an fprintd client disappears. If the client
requested for the device to be released, then, without waiting for the
reply of that release, disappeared from the bus, we would try to close
it a second time, accessing a function pointer that didn't exist
anymore.

See https://bugzilla.redhat.com/show_bug.cgi?id=1515720
2018-05-31 12:02:31 +02:00