Commit graph

340 commits

Author SHA1 Message Date
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
Bastien Nocera
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
Bastien Nocera
6f63beb1fc pam: Add str_has_prefix() helper
To simplify the options parsing.
2020-01-23 18:45:43 +01:00
Bastien Nocera
f7557c6ee7 pam: Add monotonic clock helper 2020-01-23 18:45:43 +01:00
Bastien Nocera
0b598965b0 pam: Remove GLib usage from copy/paste header 2020-01-23 18:45:43 +01:00
Bastien Nocera
8325d347d6 pam: Add str_equal() helper to copy/paste header 2020-01-23 18:45:43 +01:00
Bastien Nocera
0bdf801043 pam: Add helper to replace G_GNUC_UNUSED to copy/paste header 2020-01-23 18:45:43 +01:00
Bastien Nocera
6e3b053372 pam: Add include for bool to copy/paste header 2020-01-23 18:45:43 +01:00
Bastien Nocera
c6e72c5f28 pam: Add include for asprintf to copy/paste header 2020-01-23 18:45:43 +01:00
Bastien Nocera
986a42bcd1 pam: Update copyright notice 2020-01-23 18:45:43 +01:00
Bastien Nocera
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
Bastien Nocera
b99afd19f0 main: Use #pragma once 2020-01-23 18:25:18 +01:00
Bastien Nocera
3d6dfabd8d Revert "ci: Temporarily add newer pam_wrapper build"
This reverts commit db0ab55bef.
2020-01-23 18:25:14 +01:00
Marco Trevisan (Treviño)
67adcb59ed configure.ac: Depend on libfprint-2
libfprint changed SONAME to completely break with previous version, so
update fprintd dependency accordingly.
2020-01-23 18:24:53 +01:00
Bastien Nocera
db0ab55bef ci: Temporarily add newer pam_wrapper build
So that the test suite can pass.
2020-01-22 15:34:02 +01:00
Bastien Nocera
00b79d1a2f tests: Add test for the PAM module
Test the PAM module using pam_wrapper and our mock fprintd.

See https://lwn.net/Articles/671094/

Note that this requires a version of pam_wrapper with this bug fixed:
https://bugzilla.samba.org/show_bug.cgi?id=14245
2020-01-22 15:34:02 +01:00
Bastien Nocera
f1517af09a tests: Add fprintd-verify test that uses scripting 2020-01-20 17:31:46 +01:00
Bastien Nocera
c0bf1515fd tests: Check that verify test doesn't succeed early 2020-01-20 17:31:08 +01:00
Bastien Nocera
872089883c tests: Add scripting capabilities to the verification process
Add scripting capabilities to the verification process so that the mock
daemon can send its own results without needing the client to prod it to
do that. This is incredibly useful when the client is single threaded
and blocking.

Note that there are barely any safeguards, so the scripting task is not
cancelled if an error occurs, or the VerifyStatus signals are sent out
of order.
2020-01-20 17:26:24 +01:00
Bastien Nocera
431755becd tests: Add test for fprintd utils 2020-01-17 15:32:22 +01:00
Bastien Nocera
0a42b90390 tests: Add dbusmock template for fprintd daemon 2020-01-17 15:18:43 +01:00
Bastien Nocera
cd3ed2e450 device: Fix documentation for ERROR_INVALID_FINGERNAME 2020-01-17 14:41:22 +01:00
Bastien Nocera
c929d39df1 device: Fix "enrollemnt" typo 2020-01-17 14:40:36 +01:00
Bastien Nocera
1a5ef6c5a7 build: Add separate dependency for pam module 2020-01-14 15:52:21 +01:00
Bastien Nocera
ce3406b20f main: Fix typos in comments 2020-01-14 14:00:56 +01:00
Bastien Nocera
0d407db171 manager: Fix typo in comment 2020-01-14 14:00:56 +01:00