Commit Graph

354 Commits

Author SHA1 Message Date
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
ee6e8a6fa3 pam: Better debug when max_tries option is invalid 2020-01-24 00:51:13 +01:00
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
affffaf134 pam: Return PAM_MAXTRIES after too many tries 2020-01-24 00:51:13 +01:00
6ab270fb1a tests: Reduce the default timeout in tests 2020-01-24 00:51:13 +01:00
2d0bed6b13 tests: Add PAM timeout test 2020-01-24 00:51:13 +01:00
c43134e36f tests: Add PAM test with 2 readers 2020-01-24 00:51:13 +01:00
b9d23ddb87 tests: Fix dbusmock template when adding > 1 reader 2020-01-24 00:51:13 +01:00
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
d70f15b5e8 pam: Port to sd-bus
This pam plugin never used GDBus because it transparently uses threads
which do not work well with a lot of PAM applications. But even settling
on the "still better to use than plain dbus library" dbus-glib wasn't
without problems, as any use or initialisation of GIO sockets would
modify signal handler for signals such as SIGPIPE (see gio/gsocket.c).

Many years later, sd-bus is a more modern alternative to the bare dbus
library with a better API.

This includes:
- Removing use of gboolean, guint, g_new0() and many glib string helpers
- Simplifying debug logging
- Marking user-facing messages to be translated
2020-01-24 00:51:13 +01:00
6f63beb1fc pam: Add str_has_prefix() helper
To simplify the options parsing.
2020-01-23 18:45:43 +01:00
f7557c6ee7 pam: Add monotonic clock helper 2020-01-23 18:45:43 +01:00
0b598965b0 pam: Remove GLib usage from copy/paste header 2020-01-23 18:45:43 +01:00
8325d347d6 pam: Add str_equal() helper to copy/paste header 2020-01-23 18:45:43 +01:00
0bdf801043 pam: Add helper to replace G_GNUC_UNUSED to copy/paste header 2020-01-23 18:45:43 +01:00
6e3b053372 pam: Add include for bool to copy/paste header 2020-01-23 18:45:43 +01:00
c6e72c5f28 pam: Add include for asprintf to copy/paste header 2020-01-23 18:45:43 +01:00
986a42bcd1 pam: Update copyright notice 2020-01-23 18:45:43 +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
b99afd19f0 main: Use #pragma once 2020-01-23 18:25:18 +01:00