Commit Graph

155 Commits

Author SHA1 Message Date
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
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
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
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
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
d6c4e8ba64 file: Remove unused variable 2019-08-07 15:15:23 +02:00
48976d0031 main: Throw g_warning() on startup failure
Rather than using g_print()
2019-08-07 15:15:23 +02:00
cbf4a47af3 main: Add debug when about to load configuration file 2019-08-07 15:15:23 +02:00
bfbac18606 file: More debug on file and directory accesses 2019-08-07 15:15:23 +02:00
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
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
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
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
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
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
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
661684b1f5 main: Turn messages in debug messages
Rather than filling the logs with mostly useless messages, print those
as debug.
2018-05-30 19:59:07 +02:00
2322244c5a build: Add a log domain for fprintd debug messages 2018-05-30 19:58:20 +02:00
8e0c030f62 main: Split off events loop handling into a separate file
To make it easier to use as an example.
2018-05-25 16:06:54 +02:00
4234902671 main: Clean up main loop integration
Remove do/while loops in favour of for loops, and downgrade some
warnings and messages statements to debug.
2018-05-25 15:45:02 +02:00
e55ad52ded device: Fix warning when open the device fails
The error should be initialised to NULL before being set.
2017-02-16 15:51:22 +01:00
0d28678118 device: dbus_g_method_return_error() does not free the error
So free the errors after sending them on the bus.

https://bugs.freedesktop.org/show_bug.cgi?id=99838
2017-02-16 15:44:12 +01:00
3d2d73d615 main: call g_type_init only if using an old glib
Calling g_type_init() is not needed anymore and deprecated since
glib version 2.36.

https://bugs.freedesktop.org/show_bug.cgi?id=99812
2017-02-14 17:14:20 +01:00
8fa3dcd5cd main: Plug tiny memory leak
dbus_g_method_get_sender() returns an allocated-string which we need to
free. This is handled properly in the rest of the codebase.

https://bugs.freedesktop.org/show_bug.cgi?id=99811
2017-02-14 14:29:54 +01:00
b3c1ed0d2a main: Don't hardcode fingerprint storage directory
It used to be hard-coded to /var/lib/fprint, but is now set to
$(localstatedir)/lib/fprint/.
2017-01-05 12:50:06 +01:00
e437d20108 device: Don't call fp_async_dev_close() with NULL device
In some cases, the priv->dev is already freed and NULL, so ensure
that we don't try to close NULL devices and crash.
2015-10-14 12:12:39 +02:00
4edc17ac99 manager: Fix sorting in GetDevices() output
Sort the devices by ID for the GetDevices() output.
2015-02-03 17:07:15 +01:00
f94c8727d2 main: Don't log about normal operation
Administrators don't need to see this stuff on every boot.  The system
bus itself already logs this anyways (which is itself a bit too
chatty).

https://bugs.freedesktop.org/show_bug.cgi?id=71889
2014-04-25 11:28:20 +02:00
4f9256c033 manager: Don't log when we're exiting
This happens on hardware without fingerprint readers on every boot; we
don't need to log anything about it, it's totally normal.

This patch is part of an initiative to reduce logging spew in GNOME
so that actual errors and important messages are more visible.

https://bugs.freedesktop.org/show_bug.cgi?id=71889
2014-04-25 11:28:20 +02:00
0aaff3a6c6 device: Use non-deprecated PolKit call 2012-11-17 09:10:35 +01:00
9577b6db03 main: request name unconditionally at startup
the dbus activation machinery depends on daemons taking a name on
the bus to complete activation without timeouts.

fprintd fails prematurely if there is USB bus (as found in some
virtual machine setups).

This commit moves the bus-name-acquisition code to happen before
the fail-from-no-usb-bus code to keep callers from timing out
when activating fprintd.

https://bugs.freedesktop.org/show_bug.cgi?id=57025
2012-11-13 17:17:21 +01:00
2d11e76cb7 daemon: Use GDBus to monitor clients
Instead of the custom egg code.
2011-04-18 17:55:13 +01:00
c3de292486 daemon: Fix warning about unused variable
By unref'ing the manager object before we exit.
2011-03-30 16:43:10 +01:00
1e5c78e8d0 Remove unused variable 2011-02-22 18:27:35 +00:00
731b22d368 0.2.0
Fix a missing brace in main.c, fix distchecking.
2010-08-19 16:01:23 +01:00
7872479415 Change g_errors to g_warnings
So as to avoid aborts when D-Bus isn't available.

https://bugzilla.redhat.com/show_bug.cgi?id=549484
2010-08-17 15:34:20 +01:00
24fefbe332 Port to PolicyKit 1.0
See https://bugzilla.redhat.com/show_bug.cgi?id=498368
and
https://fedoraproject.org/wiki/Features/PolicyKitOne
2010-08-16 19:33:01 +01:00
4ea1c48f9f Detect when a device is disconnected
Pretty hacky way to detect whether the device we're handling has
been disconnected during a verify or enrollment. This should allow
us to avoid users having to wait when somebody pulls the plug.
2009-01-27 16:45:47 -03:00
d93b272f06 Install interfaces files
Apparently helps developers who want to read the interfaces
by hand, rather than using the API docs. Mentioned by Matthias in
his fprintd package review:
https://bugzilla.redhat.com/show_bug.cgi?id=469955#c9
2008-12-10 00:54:27 +00:00
6a480f409d Stop extra signals from being emitted
Some devices keep sending us signals when an enrollment or
verification finished. Ignore all those signals, we hate them.
2008-12-04 13:23:51 +00:00
c1dc3f1394 Fix fprintd exiting after a device goes unused
Simple logic error that caused fprintd to exit when a device
was used then unused.
2008-12-04 13:23:50 +00:00
69e987b335 Fix return value for GetDefaultDevice
Tell the front-end there's no devices available when there isn't
any, instead of erroring out.
2008-12-04 13:23:50 +00:00
64e415aaac Fix memleak on VerifyStart
Clean up the data pass to the async verification and identification
functions ourselves.
2008-11-24 17:20:46 +00:00
7b06c4b7f3 Review possible errors and document them
Review all the possible errors and document them for each function.
2008-11-24 17:20:46 +00:00
1abf51afa4 Don't crash the server if there's no devices
Big ninny just crashed because there's no fingerprint readers. Hoo,
hoo. My eyes are bleeding.
2008-11-24 17:20:46 +00:00
9743d9d2a0 Register errors with D-Bus
So we get errors like:
net.reactivated.Fprint.Error.DiscoverPrints
instead of:
org.freedesktop.DBus.GLib.UnmappedError.FprintdErrorQuark.Code2
2008-11-24 17:20:46 +00:00