Commit Graph

37 Commits

Author SHA1 Message Date
a5ff42394e main: De-init the storage when main loop is over 2021-03-03 19:51:07 +01:00
f73429f062 fprintd: Reindent the source code following uncrustify rules 2020-12-07 18:41:45 +01:00
e1c2698807 main: Use more auto-pointers 2020-11-11 11:40:51 +01:00
93bad82540 fprintd: Use GDBus codegen based implementation
Fprintd is dependent on the deprecated dbus-glib, also this doesn't provide
various features we can take advantage of, like the ones for async
authentication mechanism.

So, remove all the dbus-glib dependencies and simplify the code, but without
any further refactor, and keeping everything as it used to work, while this
will give room for further improvements in subsequent commits.

Internally, we just use dbus-codegen to generate the skeletons, and we
use the generated FprintdDBusManager with composition, while we
implement the device skeleton interface in FprintDevice, so that we
don't have to use it as a proxy, and keep being closer to what it used
to be with dbus-glib.

Fixes: #61
2020-11-10 14:45:59 +01:00
e828ea3b2d main: Add missing locale.h include
The include is present in all other binaries in utils/.
2020-03-19 23:33:58 -04:00
52e12459df main: Improve comments on fprint manager creation
Explain why the manager creation is async better in both in the main file
and in the manager itself
2020-02-14 16:01:01 +01:00
ee8589ec9d main: Ensure we always free context, loop and error
In case of early return we may not free them consistently, while this is not
a big problem in a main function, is better to have a cleaner management,
and we did get valgrind reports.
2020-02-14 15:55:09 +01:00
0994cc314e main: Ensure that a gcov flush happens on SIGTERM
When coverage is enabled fprintd test won't generate any .gcda file and so
apparently no data, this happens because gcov doesn't handle properly the
process termination when SIGTERM is used, and so when in fprintd.py we
terminate the process no coverage data is reported.

To avoid this, quit the main loop cleanly on SIGTERM, so that we will exit
from the main function cleanly, making libc to perform a gcov flush when we
exit the program.
2020-02-05 16:45:57 +01:00
130d6cdb63 main: Move fprintd_dbus_conn declaration to main.c
There's no need to declare it as extern in the header as it is already
declared in the source files where it's used.

Fixes:
../src/device.c:51:25: error: redundant redeclaration of ‘fprintd_dbus_conn’ [-Werror=redundant-decls]
  51 | extern DBusGConnection *fprintd_dbus_conn;
     |                         ^~~~~~~~~~~~~~~~~
In file included from ../src/device.c:34:
../src/fprintd.h:29:25: note: previous declaration of ‘fprintd_dbus_conn’ was here
  29 | extern DBusGConnection *fprintd_dbus_conn;
     |                         ^~~~~~~~~~~~~~~~~
2020-02-05 15:25:35 +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
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
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
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
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
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
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
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
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
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
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
c3de292486 daemon: Fix warning about unused variable
By unref'ing the manager object before we exit.
2011-03-30 16:43:10 +01: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
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
3cd0a7aeaf First pass at adding API docs through gtk-doc
Required a bit of mangling.
2008-11-21 18:15:51 +00:00
b0f2060628 Exit when no devices are in use
When no actions are happening on any of the devices, make the
daemon exit after 30 seconds.
2008-11-03 22:56:12 +00:00
bd2debc01e Update storage code to allow plugins
Add naive plugin support to the storage code, it will
load plugins from $(libdir)/fprintd/modules, given the configuration
from /etc/fprintd.conf.
2008-11-02 11:16:13 +00:00
5d60894e69 Add support for --g-fatal-warnings
This makes debugging warnings from fprintd easier, uses
GOption as available since glib 2.6
2008-05-16 18:21:13 +01:00
017f770480 Clean up object creation code
Make all of FPrintManager's struct members private,
warn of errors using a _get_error() function, as object
creation can never fail.

The only error possible shouldn't really be an error though,
as it only means that no devices will be enumerated, but it
could tell us about newly plugged devices instead.
2008-05-14 16:07:25 +01:00
3ad569b66a Add i18n support
This will be needed to get better error messages to
users of the D-Bus API. We use glib's builtin gettext
support. No strings marked as translatable yet, we'll
need to mark those user-visible strings carefully and
review them.
2008-05-14 16:07:20 +01:00
6cbb079619 Make the daemon a system daemon
With this patch, and the D-Bus activation patches posted earlier the
fprintd daemon is started automatically when needed.

We should have a way to exit it nicely when there are no users
anymore as well...
2008-05-13 23:10:04 +01:00
080e427651 Move to object oriented model
There is now a single Manager class shared between all apps.
Apps then share a collection of Device objects.
2008-03-05 23:52:33 +00:00
98c936dbdd Make claim and release asynchronous 2008-03-04 14:55:37 +00:00
b69cb4a705 Initial commit 2008-03-04 12:39:02 +00:00