Commit graph

365 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
95e95d2910 main: Fix "function declaration isn't a prototype" warning 2020-02-05 15:25:35 +01:00
Marco Trevisan (Treviño)
75aeff4acd tests: Increase debugging level for PAM tests 2020-02-05 15:25:35 +01:00
Marco Trevisan (Treviño)
bebd3d2a98 tests: Increase debugging for daemon tests 2020-02-05 15:25:35 +01:00
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
f5a2c21f90 build: Add configuration recap message for meson 2020-02-05 15:25:35 +01:00
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
9bed3bed3f ci: Add jobs to build and run tests using meson 2020-02-05 15:25:35 +01:00
Marco Trevisan (Treviño)
1a094c1a09 ci: Use a template to avoid repeating the libfprint-dev installation 2020-02-05 15:25:35 +01:00
Bastien Nocera
4ed46deaf2 build: Add script to update translations 2020-02-05 15:25:35 +01:00
Bastien Nocera
0724413eda README: Clean up transifex README 2020-02-05 15:25:35 +01:00
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
33a21b5089 tests/fprintd: Test error conditions on Claim()/Release() 2020-02-04 15:36:06 +01:00
Marco Trevisan (Treviño)
dd006382f5 tests/fprintd: Test ListEnrolledFingers() method 2020-02-04 15:33:09 +01:00
Marco Trevisan (Treviño)
a34432ccf9 tests/fprintd: Add assertFprintError to check errors 2020-02-04 15:28:57 +01:00
Marco Trevisan (Treviño)
f2804921a3 tests/fprintd: Use unittest assertions more often 2020-02-04 15:27:24 +01:00
Marco Trevisan (Treviño)
74577a6806 tests/fprintd: Add a FPrintdVirtualDeviceTest to avoid repeating setup 2020-02-04 15:21:50 +01:00
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
77126ccf1f device: Remove unused storage_type variable 2020-02-04 14:40:17 +01:00
Marco Trevisan (Treviño)
46b7d7c1a7 device: Clear username on open failure 2020-02-04 14:36:39 +01:00
Marco Trevisan (Treviño)
791a208afd device: Clear session, sender and username on close failure 2020-02-04 14:31:51 +01:00
Marco Trevisan (Treviño)
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
Marco Trevisan (Treviño)
8a2f276003 device: Cleanup session_data on open failure 2020-02-04 14:25:00 +01:00
Marco Trevisan (Treviño)
aab923e3cd device: Fix memory leak on object destruction
Add the missing chain-up on finalize().
2020-02-04 14:22:01 +01:00
Marco Trevisan (Treviño)
cc4bac3410 main: Use G_DECLARE_FINAL_TYPE to define objet 2020-02-04 14:19:41 +01:00
Bastien Nocera
18d4aa6d7d pam: Use systemd to check whether a session is remote
Closes: #3
2020-02-04 14:01:29 +01:00
Bastien Nocera
046ec8dbf4 pam: Split off remote session code 2020-02-04 14:01:29 +01:00
Bastien Nocera
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
Bastien Nocera
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
Bastien Nocera
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
Bastien Nocera
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
Bastien Nocera
b97903f781 data: Update built man pages
As used in the dist tarball.
2020-01-24 17:03:43 +01:00
Bastien Nocera
a30697a28d data: Add pam_fprintd man page
Closes: #24
2020-01-24 17:03:43 +01:00
Bastien Nocera
aad3212d22 data: Update links to other man pages 2020-01-24 17:03:43 +01:00
Bastien Nocera
3624bcb114 data: Fix copy/paste error in fprintd-verify's man page 2020-01-24 17:03:43 +01:00
Bastien Nocera
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
Bastien Nocera
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
Bastien Nocera
6089ba6f40 pam: Better debug when timeout is invalid 2020-01-24 00:51:13 +01:00
Bastien Nocera
ee6e8a6fa3 pam: Better debug when max_tries option is invalid 2020-01-24 00:51:13 +01:00
Bastien Nocera
42f5280a03 pam: Better debug arguments support
Support debug=[on|off|true|false|1|0] as an option in addition to
"debug".
2020-01-24 00:51:13 +01:00
Bastien Nocera
affffaf134 pam: Return PAM_MAXTRIES after too many tries 2020-01-24 00:51:13 +01:00
Bastien Nocera
6ab270fb1a tests: Reduce the default timeout in tests 2020-01-24 00:51:13 +01:00
Bastien Nocera
2d0bed6b13 tests: Add PAM timeout test 2020-01-24 00:51:13 +01:00
Bastien Nocera
c43134e36f tests: Add PAM test with 2 readers 2020-01-24 00:51:13 +01:00
Bastien Nocera
b9d23ddb87 tests: Fix dbusmock template when adding > 1 reader 2020-01-24 00:51:13 +01:00
Bastien Nocera
205dedae4f tests: Add dbus-monitor'ing to PAM tests
Should prove useful debugging the PAM module if we need it.
2020-01-24 00:51:13 +01:00