Commit Graph

373 Commits

Author SHA1 Message Date
dccc5796b6 ci: Enable coverage reports in test build 2020-02-05 16:45:57 +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
09b1f1f1db ci: Compile with --werror in build_dev 2020-02-05 15:25:35 +01:00
e10417a907 verify: Constify username
utils/verify.c:191:12: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
191 |   username = "";
    |            ^
2020-02-05 15:25:35 +01:00
8f75563920 enroll: Fix usernames memory leak
usernames was not freed on exit.
2020-02-05 15:25:35 +01:00
2e00c7a4b1 enroll: Always use allocated memory for finger name
Given that finger_name is set by GOptionEntry, make sure it's always
using allocated memory.

../utils/enroll.c:38:28: error: initialization discards ‘const’ qualifier
  from pointer target type [-Werror=discarded-qualifiers]
38 | static char *finger_name = "right-index-finger";
   |                            ^~~~~~~~~~~~~~~~~~~~
2020-02-05 15:25:35 +01:00
72d8a0f512 build: Enable -Werror on redundant declarations
Now that we've fixed our own errors.
2020-02-05 15:25:35 +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
e2fd52190a main: Fix "function declaration isn't a prototype" warning
../src/file_storage.c:47:20: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
47 | static const char *get_storage_path()
   |                    ^~~~~~~~~~~~~~~~
../src/file_storage.c: In function ‘get_storage_path’:
../src/file_storage.c:47:20: warning: old-style function definition [-Wold-style-definition]
../src/file_storage.c: In function ‘file_storage_discover_users’:
../src/file_storage.c:270:9: warning: old-style function definition [-Wold-style-definition]
270 | GSList *file_storage_discover_users()
    |         ^~~~~~~~~~~~~~~~
2020-02-05 15:25:35 +01:00
7d8450e5ab device: Mark fingers names array as const and use unique name
With the stronger warnings enabled when building with meson, we get a
warning for all the fingers definitions:

  ../src/device.c:38:24: warning: initialization discards ‘const’ qualifier
  from pointer target type [-Wdiscarded-qualifiers]
    38 |  [FP_FINGER_UNKNOWN] = "unknown",

As the `fingers` array name was shadowed in another file:

  ../src/device.c:1000:11: warning: declaration of ‘fingers’ shadows a
  global declaration [-Wshadow]
    1000 |   GSList *fingers, *finger;
2020-02-05 15:25:35 +01:00
95e95d2910 main: Fix "function declaration isn't a prototype" warning 2020-02-05 15:25:35 +01:00
75aeff4acd tests: Increase debugging level for PAM tests 2020-02-05 15:25:35 +01:00
bebd3d2a98 tests: Increase debugging for daemon tests 2020-02-05 15:25:35 +01:00
0e2bf7e804 build: Check translations using a script
Use a bash script to check the translations as we used to do during
the autotools-based distcheck.
2020-02-05 15:25:35 +01:00
f5a2c21f90 build: Add configuration recap message for meson 2020-02-05 15:25:35 +01:00
53d80c1474 build: Use gettext to translate policy file with meson
Recent versions of gettext can merge translations in xml files,
so use it and remove the intltool dependency for meson builds.
2020-02-05 15:25:35 +01:00
9bed3bed3f ci: Add jobs to build and run tests using meson 2020-02-05 15:25:35 +01:00
1a094c1a09 ci: Use a template to avoid repeating the libfprint-dev installation 2020-02-05 15:25:35 +01:00
4ed46deaf2 build: Add script to update translations 2020-02-05 15:25:35 +01:00
0724413eda README: Clean up transifex README 2020-02-05 15:25:35 +01:00
eb6dbb6953 build: Add meson build system
Reuse the generated dbus interface .xml files from fprintd to avoid
unnecessary copies.
2020-02-05 15:25:35 +01:00
5c5849dca7 build: Don't hardcode libtool specific build path
Don't hardcode the libtool specific build path in the configuration
file, but in the build declaration instead.
2020-02-05 13:43:27 +01:00
048181ae7f test_fprintd_utils: Support running under valgrind
Like for the fprintd test, run the tests under valgrind if the `VALGRIND`
environment variable is set, and use the contents of the variable as the
path to the suppression file.
2020-02-04 15:39:01 +01:00
8e3345a60f tests: Fix num-enroll-stages signature in dbusmock template
It's marked as a signed integer, not an unsigned one in the API.
2020-02-04 15:38:17 +01:00
33a21b5089 tests/fprintd: Test error conditions on Claim()/Release() 2020-02-04 15:36:06 +01:00
dd006382f5 tests/fprintd: Test ListEnrolledFingers() method 2020-02-04 15:33:09 +01:00
a34432ccf9 tests/fprintd: Add assertFprintError to check errors 2020-02-04 15:28:57 +01:00
f2804921a3 tests/fprintd: Use unittest assertions more often 2020-02-04 15:27:24 +01:00
74577a6806 tests/fprintd: Add a FPrintdVirtualDeviceTest to avoid repeating setup 2020-02-04 15:21:50 +01:00
2076025208 device: Use session data for context, sender and user
Use the device session data to store all the informations we care about
while a device is claimed, and make its cleanup easier.

Keep just one instance of the current context, given we use it only during
claim and release, and those are mutually exclusive operations.
2020-02-04 14:54:20 +01:00
77126ccf1f device: Remove unused storage_type variable 2020-02-04 14:40:17 +01:00
46b7d7c1a7 device: Clear username on open failure 2020-02-04 14:36:39 +01:00
791a208afd device: Clear session, sender and username on close failure 2020-02-04 14:31:51 +01:00
b832002c97 device: Use malloc-allocated SessionData
Allocate SessionData using g_malloc(). There are no benefits to using
GSlice for a seldom used structure. This also allows use to use
g_clear_pointer() to free the struct.
2020-02-04 14:30:10 +01:00
8a2f276003 device: Cleanup session_data on open failure 2020-02-04 14:25:00 +01:00
aab923e3cd device: Fix memory leak on object destruction
Add the missing chain-up on finalize().
2020-02-04 14:22:01 +01:00
cc4bac3410 main: Use G_DECLARE_FINAL_TYPE to define objet 2020-02-04 14:19:41 +01:00
18d4aa6d7d pam: Use systemd to check whether a session is remote
Closes: #3
2020-02-04 14:01:29 +01:00
046ec8dbf4 pam: Split off remote session code 2020-02-04 14:01:29 +01:00
874b4556ef pam: Remove unneeded assignments
Don't use return messages for D-Bus calls when we're not interested in
those return values.
2020-02-04 14:01:29 +01:00
c2aa5c0b9a pam: Fix possible memory leak
If we exited early from the loop, we need to make sure to free() this
struct member.
2020-02-04 13:48:25 +01:00
f745c49112 pam: Fix PAM authentication when it's the last try
We need to make sure that the max_tries variable isn't decremented
further when we have success in the verification loop. Add missing break
to do that.

Fixes: affffaf134
Closes: #40
2020-02-04 13:48:00 +01:00
319d859107 tests: Add PAM test that succeeds on last try
Exhaust all the tries (minus 1) before having a match on the last try.
This should not throw a warning.
2020-02-04 13:35:48 +01:00
b97903f781 data: Update built man pages
As used in the dist tarball.
2020-01-24 17:03:43 +01:00
a30697a28d data: Add pam_fprintd man page
Closes: #24
2020-01-24 17:03:43 +01:00
aad3212d22 data: Update links to other man pages 2020-01-24 17:03:43 +01:00
3624bcb114 data: Fix copy/paste error in fprintd-verify's man page 2020-01-24 17:03:43 +01:00
8fbc59a258 pam: Allow unloading libs that pam_fprintd is linked to
Remove "nodelete" linker flag now that we use sd-bus and not dbus-glib,
so that libraries that pam_fprintd links to can be unloaded.

This was added because GLib's type system expects to be initialised
once and only once per process, and re-loading this type system when it
had already been initialised caused crashes.
2020-01-24 17:03:43 +01:00
5a8da0022a tests: Make warnings fatal in PAM tests
This will catch problems with GLib being unloaded when the PAM module is
unloaded, which would have crashed when using dbus-glib.

This serves as a test for https://gitlab.freedesktop.org/libfprint/fprintd/issues/2

Closes: #2
2020-01-24 17:03:32 +01:00
6089ba6f40 pam: Better debug when timeout is invalid 2020-01-24 00:51:13 +01:00