Commit graph

72 commits

Author SHA1 Message Date
Bastien Nocera
b90b21f26b build: Make pam module installation dir configurable
And avoid treating "libdir" as an absolute path, the documentation
clearly states that it is "relative to the prefix".

Based on patch by Timothy Gu <timothygu99@gmail.com>
2020-02-10 14:49:11 +01:00
Bastien Nocera
b02825620a Revert "build: Ensure that gcov symbols are exposed when needed"
This reverts commit 526b2e8c53.

Commit 0994cc31 was enough to implement the coverage support.
2020-02-05 17:09:19 +01:00
Marco Trevisan (Treviño)
526b2e8c53 build: Ensure that gcov symbols are exposed when needed
When coverage is enabled, we need to expose the __gcov_* symbols in the
binaries and libraries or we won't get any coverage report for them.
2020-02-05 16:54:54 +01:00
Bastien Nocera
73625233f6 build: Remove autotools support 2020-02-05 16:54:54 +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
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
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
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
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
1a5ef6c5a7 build: Add separate dependency for pam module 2020-01-14 15:52:21 +01:00
Bastien Nocera
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
Benjamin Berg
96444b4156 pam: Fix rhost string length check 2019-08-13 14:16:32 +02:00
Bastien Nocera
8f90390c6b pam: Fix rhost check when rhost is unavailable
Don't exit early if the rhost field isn't filled in, as it usually isn't
for a lot of services.

Fixes: 3274a31
2019-08-08 12:31:32 +02:00
Bastien Nocera
3274a31153 pam: Don't ask for fingerprints for remote logins
As written in the "Linux-PAM Application Developers' Guide"
at http://www.linux-pam.org/Linux-PAM-html/adg-security-user-identity.html:
"
As a general rule, the following convention for its value can be
assumed: NULL = unknown; localhost = invoked directly from the
local system; other.place.xyz = some component of the user's
connection originates from this remote/requesting host.
"

So also exit early if the hostname isn't localhost as it should be.

Closes: #21
2019-08-07 14:12:53 +00:00
Corentin Noël
51f4dce4e7 pam: Fix typo in occurred 2018-11-09 07:41:42 +01:00
Bastien Nocera
f39f28830a pam: Avoid errors when using parts of the copy/paste header
If not all the functions in the header are used, we'd get warnings about
them being unused. Mark all the functions as unused, so we can avoid
warnings.
2018-02-06 14:12:41 +01:00
Christian Kellner
051eb0427d pam: Don't poke the hardware if user has no registered prints
Before claiming the device and therefore potentially activating
the actual hardware, make a call to see if the user has any
prints registered at all.

https://bugs.freedesktop.org/show_bug.cgi?id=99811
2017-02-16 14:49:58 +01:00
Christian Kellner
f54a90ea80 pam: separate device opening and claiming
For some operations, i.e. listing the enrolled prints, the device
does not need to be claimed. Therefore the claiming can be delayed
until we actually start the verification process, allowing us to
query the fingerprint system if the user has any prints enrolled.

https://bugs.freedesktop.org/show_bug.cgi?id=99811
2017-02-16 14:46:35 +01:00
Christian Kellner
da87d1d7ee pam: Only call g_type_init when 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
Bastien Nocera
9acacefa18 pam: Fix "format-nonliteral" warning
In file included from tests/enroll.c:29:0:
pam/fingerprint-strings.h: In function ‘finger_str_to_msg’:
pam/fingerprint-strings.h:99:6: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
      return g_strdup_printf (TR (fingers[i].place_str_specific), driver_name);
      ^~~~~~
pam/fingerprint-strings.h:104:6: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
      return g_strdup_printf (TR (fingers[i].swipe_str_specific), driver_name);
      ^~~~~~
2016-07-19 11:27:17 +02:00
Bastien Nocera
7e4630ced2 pam: Fix eventfd leak
When we create our own GMainContext, we need to be the ones
disposing of it as well, as GMainLoop won't take ownership of it.

From https://bugzilla.redhat.com/show_bug.cgi?id=1050827
2014-01-27 12:25:57 +01:00
Rob Johnson
b4f5304565 pam: return PAM_UNKNOWN_USER when user is unenrolled
This commit makes pam_fprintd return PAM_UNKNOWN_USER when
the user has not enrolled a fingerprint.

This lets the administrator set up pam_fprintd as a required
authentication, method, but only for users that have enrolled a
fingerprint, as such:

auth  [success=ok user_unknown=ignore default=die] pam_fprintd.so max_tries=1 timeout=-1
auth  [success=1  default=ignore]                  pam_unix.so nullok_secure
auth  requisite                                    pam_deny.so

With this config, users w/o an enrolled fingerprint will just be
asked for a password.  Users with an enrolled fingerprint will
required to login using both their fingerprint and a password.

https://bugs.freedesktop.org/show_bug.cgi?id=64781
2013-06-03 08:56:22 -04:00
Didier Raboud
9c99e5cd59 pam: Make max_tries and timeout arguments.
https://bugs.freedesktop.org/show_bug.cgi?id=49918
2013-03-26 12:45:58 +01:00
Didier Raboud
73edad087f pam: Avoid segfault on login without devices
Avoid crashing if paths_array is NULL.

https://bugs.freedesktop.org/show_bug.cgi?id=49904
2012-05-14 15:09:25 +01:00
Bastien Nocera
4c120e487b pam: Fix crash when enumerating the devices
We don't need to free this by hand, it'll get freed when
we free the array itself.
2012-02-07 21:43:28 +00:00
Bastien Nocera
cde767cbc9 pam: Don't get a list of devices twice
GetDefaultDevice just gives you the first device in the list.
Use that fact to check for > 1 device, and get the default device
in one swoop.
2012-02-01 19:53:26 +00:00
Dan Winship
d77b59cd36 pam: don't use device name if there is only one reader 2012-02-01 19:41:58 +00:00
Ray Strode
00ac488cde Don't every allow pam module to get unloaded
The PAM module uses dbus-glib, static gobject types, etc,
so it really can't get unloaded.

This commit adds some linker-fu to keep it resident even
after the pam module closes.
2010-11-09 11:32:31 -05:00
Bastien Nocera
749b6ca31c Fix redefinition warning in pam_fprintd 2010-09-11 14:58:29 +01:00
Bastien Nocera
ebd97c70ff Translate the messages from pam_fprintd
Using our new fangled translations
2010-09-11 14:56:57 +01:00
Bastien Nocera
731b22d368 0.2.0
Fix a missing brace in main.c, fix distchecking.
2010-08-19 16:01:23 +01:00
Ray Strode
7544102f2e Fix screensaver unlock for some users
pam_fprintd is very careful to use its own main loop context (as it
should) to prevent getting in the way of the gnome-screensaver.

Unfortunately, there's a small bug in its logic where it ends up
removing a random file descriptor from the default context. In the
bug report that file descriptor is really important.  It's what
tells gnome-screensaver when to drop the dialog.

The patch is as simple as:

-   g_source_remove (timeout_id);
+   g_source_destroy (source);

(g_source_remove always operates on the default context)

https://bugzilla.redhat.com/show_bug.cgi?id=614573
2010-08-16 19:35:57 +01:00
Matthias Clasen
24fefbe332 Port to PolicyKit 1.0
See https://bugzilla.redhat.com/show_bug.cgi?id=498368
and
https://fedoraproject.org/wiki/Features/PolicyKitOne
2010-08-16 19:33:01 +01:00
Bastien Nocera
4ea1c48f9f Detect when a device is disconnected
Pretty hacky way to detect whether the device we're handling has
been disconnected during a verify or enrollment. This should allow
us to avoid users having to wait when somebody pulls the plug.
2009-01-27 16:45:47 -03:00
Bastien Nocera
bbead87f58 Fix distcheck
A single file missing from the distribution.
2009-01-27 16:45:16 -03:00