mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 12:23:34 +02:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 267b322f6d | |||
| 3b83240e57 | |||
| 897cbd341e | |||
| 9d0305ea05 | |||
| 3dbfdabe01 | |||
| 45cf63d589 | |||
| 29ed88a50a | |||
| e301779c20 | |||
| be5d283a3e | |||
| ebfcbdd13e | |||
| ec7376d7e6 | |||
| df568e1ce1 | |||
| 7ee61393ec | |||
| 57ca0dc95e | |||
| 85ba309e9d | |||
| 3f2174676e | |||
| 5e18d46971 | |||
| a8bd2bc25e |
11
NEWS
11
NEWS
@ -1,6 +1,17 @@
|
|||||||
This file lists notable changes in each release. For the full history of all
|
This file lists notable changes in each release. For the full history of all
|
||||||
changes, see ChangeLog.
|
changes, see ChangeLog.
|
||||||
|
|
||||||
|
Version 1.90.5:
|
||||||
|
|
||||||
|
The 1.90.4 release contained some bad errors, this release addresses those.
|
||||||
|
|
||||||
|
Highlights:
|
||||||
|
- Permit building with polkit older than 0.114
|
||||||
|
- Fix possible issues with PAM test
|
||||||
|
- Fix incorrect DBus policy
|
||||||
|
- Fix build so that CFLAGS enviroment is correctly used
|
||||||
|
- Skip hotplug test with older libfprint (which times out otherwise)
|
||||||
|
|
||||||
Version 1.90.4:
|
Version 1.90.4:
|
||||||
|
|
||||||
This fprintd release contains major core reworkings and improved testing.
|
This fprintd release contains major core reworkings and improved testing.
|
||||||
|
|||||||
@ -9,3 +9,6 @@
|
|||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#mesondefine VERSION
|
#mesondefine VERSION
|
||||||
|
|
||||||
|
/* Whether current polkit version supports autopointers */
|
||||||
|
#mesondefine POLKIT_HAS_AUTOPOINTERS
|
||||||
|
|||||||
@ -12,8 +12,16 @@
|
|||||||
|
|
||||||
<!-- Anyone can talk to the service -->
|
<!-- Anyone can talk to the service -->
|
||||||
<policy context="default">
|
<policy context="default">
|
||||||
<allow send_destination="net.reactivated.Fprint"/>
|
<allow send_destination="net.reactivated.Fprint"
|
||||||
<allow send_interface="net.reactivated.Fprint"/>
|
send_interface="net.reactivated.Fprint"/>
|
||||||
|
|
||||||
|
<!-- Basic D-Bus API stuff -->
|
||||||
|
<allow send_destination="net.reactivated.Fprint"
|
||||||
|
send_interface="org.freedesktop.DBus.Introspectable"/>
|
||||||
|
<allow send_destination="net.reactivated.Fprint"
|
||||||
|
send_interface="org.freedesktop.DBus.Properties"/>
|
||||||
|
<allow send_destination="net.reactivated.Fprint"
|
||||||
|
send_interface="org.freedesktop.DBus.ObjectManager"/>
|
||||||
</policy>
|
</policy>
|
||||||
|
|
||||||
</busconfig>
|
</busconfig>
|
||||||
|
|||||||
93
meson.build
93
meson.build
@ -1,49 +1,10 @@
|
|||||||
project('fprintd', 'c',
|
project('fprintd', 'c',
|
||||||
version: '1.90.4',
|
version: '1.90.5',
|
||||||
license: 'GPLv2+',
|
license: 'GPLv2+',
|
||||||
default_options: [
|
default_options: [
|
||||||
'buildtype=debugoptimized',
|
'buildtype=debugoptimized',
|
||||||
'warning_level=1',
|
'warning_level=3',
|
||||||
'c_std=gnu99',
|
'c_std=gnu99',
|
||||||
'c_args=' + ' '.join([
|
|
||||||
'-fno-strict-aliasing',
|
|
||||||
'-Wall',
|
|
||||||
'-Wcast-align',
|
|
||||||
'-Werror=address',
|
|
||||||
'-Werror=array-bounds',
|
|
||||||
'-Werror=empty-body',
|
|
||||||
'-Werror=implicit',
|
|
||||||
'-Werror=init-self',
|
|
||||||
'-Werror=int-to-pointer-cast',
|
|
||||||
'-Werror=main',
|
|
||||||
'-Werror=missing-braces',
|
|
||||||
'-Werror=nonnull',
|
|
||||||
'-Werror=pointer-to-int-cast',
|
|
||||||
'-Werror=redundant-decls',
|
|
||||||
'-Werror=return-type',
|
|
||||||
'-Werror=sequence-point',
|
|
||||||
'-Werror=trigraphs',
|
|
||||||
'-Werror=write-strings',
|
|
||||||
'-Wformat-nonliteral',
|
|
||||||
'-Wformat-security',
|
|
||||||
'-Wformat=2',
|
|
||||||
'-Wignored-qualifiers',
|
|
||||||
'-Wimplicit-function-declaration',
|
|
||||||
'-Wlogical-op',
|
|
||||||
'-Wmissing-declarations',
|
|
||||||
'-Wmissing-format-attribute',
|
|
||||||
'-Wmissing-include-dirs',
|
|
||||||
'-Wmissing-noreturn',
|
|
||||||
'-Wmissing-prototypes',
|
|
||||||
'-Wnested-externs',
|
|
||||||
'-Wold-style-definition',
|
|
||||||
'-Wpointer-arith',
|
|
||||||
'-Wshadow',
|
|
||||||
'-Wstrict-prototypes',
|
|
||||||
'-Wtype-limits',
|
|
||||||
'-Wundef',
|
|
||||||
'-Wunused',
|
|
||||||
]),
|
|
||||||
],
|
],
|
||||||
meson_version: '>= 0.50.0')
|
meson_version: '>= 0.50.0')
|
||||||
|
|
||||||
@ -51,6 +12,55 @@ gnome = import('gnome')
|
|||||||
i18n = import('i18n')
|
i18n = import('i18n')
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
common_cflags = cc.get_supported_arguments([
|
||||||
|
'-fno-strict-aliasing',
|
||||||
|
'-Wcast-align',
|
||||||
|
'-Werror=address',
|
||||||
|
'-Werror=array-bounds',
|
||||||
|
'-Werror=empty-body',
|
||||||
|
'-Werror=implicit',
|
||||||
|
'-Werror=init-self',
|
||||||
|
'-Werror=int-to-pointer-cast',
|
||||||
|
'-Werror=main',
|
||||||
|
'-Werror=missing-braces',
|
||||||
|
'-Werror=nonnull',
|
||||||
|
'-Werror=pointer-to-int-cast',
|
||||||
|
'-Werror=redundant-decls',
|
||||||
|
'-Werror=return-type',
|
||||||
|
'-Werror=sequence-point',
|
||||||
|
'-Werror=trigraphs',
|
||||||
|
'-Werror=write-strings',
|
||||||
|
'-Wformat-nonliteral',
|
||||||
|
'-Wformat-security',
|
||||||
|
'-Wformat=2',
|
||||||
|
'-Wignored-qualifiers',
|
||||||
|
'-Wimplicit-function-declaration',
|
||||||
|
'-Wlogical-op',
|
||||||
|
'-Wmissing-declarations',
|
||||||
|
'-Wmissing-format-attribute',
|
||||||
|
'-Wmissing-include-dirs',
|
||||||
|
'-Wmissing-noreturn',
|
||||||
|
'-Wmissing-prototypes',
|
||||||
|
'-Wnested-externs',
|
||||||
|
'-Wold-style-definition',
|
||||||
|
'-Wpointer-arith',
|
||||||
|
'-Wshadow',
|
||||||
|
'-Wstrict-prototypes',
|
||||||
|
'-Wtype-limits',
|
||||||
|
'-Wundef',
|
||||||
|
'-Wunused',
|
||||||
|
])
|
||||||
|
add_project_arguments(common_cflags, language: 'c')
|
||||||
|
|
||||||
|
common_cflags = cc.get_supported_arguments([
|
||||||
|
# The stub passes a lot of params that we do not use, maybe a good idea to
|
||||||
|
# mark it appropriately, but this works well for now.
|
||||||
|
'-Wno-unused-parameter',
|
||||||
|
# We use g_signal_handlers_disconnect_* which is not compatible with -Wpedantic
|
||||||
|
'-Wno-pedantic',
|
||||||
|
])
|
||||||
|
add_project_arguments(common_cflags, language: 'c')
|
||||||
|
|
||||||
host_system = host_machine.system()
|
host_system = host_machine.system()
|
||||||
glib_min_version = '2.56'
|
glib_min_version = '2.56'
|
||||||
libfprint_min_version = '1.90.1'
|
libfprint_min_version = '1.90.1'
|
||||||
@ -139,6 +149,7 @@ cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
|||||||
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||||
cdata.set_quoted('VERSION', meson.project_version())
|
cdata.set_quoted('VERSION', meson.project_version())
|
||||||
cdata.set_quoted('SYSCONFDIR', sysconfdir)
|
cdata.set_quoted('SYSCONFDIR', sysconfdir)
|
||||||
|
cdata.set('POLKIT_HAS_AUTOPOINTERS', polkit_gobject_dep.version().version_compare('>= 0.114'))
|
||||||
|
|
||||||
config_h = configure_file(
|
config_h = configure_file(
|
||||||
input: 'config.h.in',
|
input: 'config.h.in',
|
||||||
|
|||||||
@ -217,7 +217,7 @@ verify_finger_selected (sd_bus_message *m,
|
|||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
if (sd_bus_message_read_basic (m, 's', &finger_name) < 0) {
|
if (sd_bus_message_read_basic (m, 's', &finger_name) < 0) {
|
||||||
pam_syslog (data->pamh, LOG_ERR, "Failed to parse VerifyFingerSelected signal: %m");
|
pam_syslog (data->pamh, LOG_ERR, "Failed to parse VerifyFingerSelected signal: %d", errno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,7 +558,7 @@ static int do_auth(pam_handle_t *pamh, const char *username)
|
|||||||
sd_bus *bus = NULL;
|
sd_bus *bus = NULL;
|
||||||
|
|
||||||
if (sd_bus_open_system (&bus) < 0) {
|
if (sd_bus_open_system (&bus) < 0) {
|
||||||
pam_syslog (pamh, LOG_ERR, "Error with getting the bus: %m");
|
pam_syslog (pamh, LOG_ERR, "Error with getting the bus: %d", errno);
|
||||||
return PAM_AUTHINFO_UNAVAIL;
|
return PAM_AUTHINFO_UNAVAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,7 +613,7 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
|
|||||||
const char **argv)
|
const char **argv)
|
||||||
{
|
{
|
||||||
const char *username;
|
const char *username;
|
||||||
unsigned i;
|
int i;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||||
|
|||||||
10
src/device.c
10
src/device.c
@ -129,6 +129,12 @@ enum fprint_device_signals {
|
|||||||
static guint32 last_id = ~0;
|
static guint32 last_id = ~0;
|
||||||
static guint signals[NUM_SIGNALS] = { 0, };
|
static guint signals[NUM_SIGNALS] = { 0, };
|
||||||
|
|
||||||
|
#ifndef POLKIT_HAS_AUTOPOINTERS
|
||||||
|
/* FIXME: Remove this once we're fine to depend on polkit 0.114 */
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAuthorizationResult, g_object_unref)
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitSubject, g_object_unref)
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
session_data_unref(SessionData *session)
|
session_data_unref(SessionData *session)
|
||||||
{
|
{
|
||||||
@ -786,8 +792,6 @@ static gboolean fprint_device_claim (FprintDBusDevice *dbus_dev,
|
|||||||
|
|
||||||
session = session_data_set_new (priv, g_steal_pointer (&sender), g_steal_pointer(&user));
|
session = session_data_set_new (priv, g_steal_pointer (&sender), g_steal_pointer(&user));
|
||||||
session->invocation = g_object_ref (invocation);
|
session->invocation = g_object_ref (invocation);
|
||||||
username = g_steal_pointer (&user);
|
|
||||||
sender = g_steal_pointer (&sender);
|
|
||||||
|
|
||||||
g_debug ("user '%s' claiming the device: %d", session->username, priv->id);
|
g_debug ("user '%s' claiming the device: %d", session->username, priv->id);
|
||||||
|
|
||||||
@ -1026,7 +1030,7 @@ static gboolean fprint_device_verify_start (FprintDBusDevice *dbus_dev,
|
|||||||
g_autoptr(FpPrint) print = NULL;
|
g_autoptr(FpPrint) print = NULL;
|
||||||
g_autoptr(SessionData) session = NULL;
|
g_autoptr(SessionData) session = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
guint finger_num = finger_name_to_num (finger_name);
|
int finger_num = finger_name_to_num (finger_name);
|
||||||
|
|
||||||
if (!_fprint_device_check_claimed (rdev, invocation, STATE_CLAIMED, &error)) {
|
if (!_fprint_device_check_claimed (rdev, invocation, STATE_CLAIMED, &error)) {
|
||||||
g_dbus_method_invocation_return_gerror (invocation, error);
|
g_dbus_method_invocation_return_gerror (invocation, error);
|
||||||
|
|||||||
@ -138,6 +138,8 @@ class FPrintdTest(dbusmock.DBusTestCase):
|
|||||||
fprintd = None
|
fprintd = None
|
||||||
cls._polkitd = None
|
cls._polkitd = None
|
||||||
|
|
||||||
|
cls._has_hotplug = FPrint.Device.find_property("removed") is not None
|
||||||
|
|
||||||
if 'FPRINT_BUILD_DIR' in os.environ:
|
if 'FPRINT_BUILD_DIR' in os.environ:
|
||||||
print('Testing local build')
|
print('Testing local build')
|
||||||
build_dir = os.environ['FPRINT_BUILD_DIR']
|
build_dir = os.environ['FPRINT_BUILD_DIR']
|
||||||
@ -688,6 +690,9 @@ class FPrintdVirtualDeviceTest(FPrintdVirtualDeviceBaseTest):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
def test_removal_during_enroll(self):
|
def test_removal_during_enroll(self):
|
||||||
|
if not self._has_hotplug:
|
||||||
|
self.skipTest("libfprint is too old for hotplug")
|
||||||
|
|
||||||
self._polkitd_obj.SetAllowed(['net.reactivated.fprint.device.setusername',
|
self._polkitd_obj.SetAllowed(['net.reactivated.fprint.device.setusername',
|
||||||
'net.reactivated.fprint.device.enroll'])
|
'net.reactivated.fprint.device.enroll'])
|
||||||
self.device.Claim('(s)', 'testuser')
|
self.device.Claim('(s)', 'testuser')
|
||||||
@ -732,6 +737,11 @@ class FPrintdVirtualDeviceClaimedTest(FPrintdVirtualDeviceBaseTest):
|
|||||||
self.device.VerifyStart('(s)', 'any')
|
self.device.VerifyStart('(s)', 'any')
|
||||||
|
|
||||||
def test_enroll_verify_list_delete(self):
|
def test_enroll_verify_list_delete(self):
|
||||||
|
# This test can trigger a race in older libfprint, only run if we have
|
||||||
|
# hotplug support, which coincides with the fixed release.
|
||||||
|
if not self._has_hotplug:
|
||||||
|
self.skipTest("libfprint is too old for hotplug")
|
||||||
|
|
||||||
with self.assertFprintError('NoEnrolledPrints'):
|
with self.assertFprintError('NoEnrolledPrints'):
|
||||||
self.device.ListEnrolledFingers('(s)', 'testuser')
|
self.device.ListEnrolledFingers('(s)', 'testuser')
|
||||||
|
|
||||||
@ -792,18 +802,29 @@ class FPrintdVirtualDeviceClaimedTest(FPrintdVirtualDeviceBaseTest):
|
|||||||
self.assertFalse(os.path.exists(os.path.join(self.state_dir, 'testuser/virtual_image/0/7')))
|
self.assertFalse(os.path.exists(os.path.join(self.state_dir, 'testuser/virtual_image/0/7')))
|
||||||
|
|
||||||
def test_enroll_invalid_storage_dir(self):
|
def test_enroll_invalid_storage_dir(self):
|
||||||
if 'CI_PROJECT_NAME' in os.environ:
|
# Directory wil not exist yet
|
||||||
self.skipTest('Permissions aren\'t respected in CI environment')
|
|
||||||
os.makedirs(self.state_dir, mode=0o500)
|
os.makedirs(self.state_dir, mode=0o500)
|
||||||
self.addCleanup(os.chmod, self.state_dir, mode=0o700)
|
self.addCleanup(os.chmod, self.state_dir, mode=0o700)
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.open(os.path.join(self.state_dir, "testfile"), os.O_CREAT | os.O_WRONLY)
|
||||||
|
self.skipTest('Permissions aren\'t respected (CI environment?)')
|
||||||
|
except PermissionError:
|
||||||
|
pass
|
||||||
|
|
||||||
self.enroll_image('whorl', expected_result='enroll-failed')
|
self.enroll_image('whorl', expected_result='enroll-failed')
|
||||||
|
|
||||||
def test_verify_invalid_storage_dir(self):
|
def test_verify_invalid_storage_dir(self):
|
||||||
if 'CI_PROJECT_NAME' in os.environ:
|
|
||||||
self.skipTest('Permissions aren\'t respected in CI environment')
|
|
||||||
self.enroll_image('whorl')
|
self.enroll_image('whorl')
|
||||||
os.chmod(self.state_dir, mode=0o000)
|
os.chmod(self.state_dir, mode=0o000)
|
||||||
self.addCleanup(os.chmod, self.state_dir, mode=0o700)
|
self.addCleanup(os.chmod, self.state_dir, mode=0o700)
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.open(os.path.join(self.state_dir, "testfile"), os.O_CREAT | os.O_WRONLY)
|
||||||
|
self.skipTest('Permissions aren\'t respected (CI environment?)')
|
||||||
|
except PermissionError:
|
||||||
|
pass
|
||||||
|
|
||||||
with self.assertFprintError('NoEnrolledPrints'):
|
with self.assertFprintError('NoEnrolledPrints'):
|
||||||
self.device.VerifyStart('(s)', 'any')
|
self.device.VerifyStart('(s)', 'any')
|
||||||
|
|
||||||
@ -1419,6 +1440,10 @@ class FPrintdUtilsTest(FPrintdVirtualDeviceBaseTest):
|
|||||||
print('Testing JHBuild version')
|
print('Testing JHBuild version')
|
||||||
jhbuild_prefix = os.environ['JHBUILD_PREFIX']
|
jhbuild_prefix = os.environ['JHBUILD_PREFIX']
|
||||||
path = os.path.join(jhbuild_prefix, 'bin', util_bin)
|
path = os.path.join(jhbuild_prefix, 'bin', util_bin)
|
||||||
|
else:
|
||||||
|
# Assume it is in path
|
||||||
|
utils[util] = util_bin
|
||||||
|
continue
|
||||||
|
|
||||||
assert os.path.exists(path), 'failed to find {} in {}'.format(util, path)
|
assert os.path.exists(path), 'failed to find {} in {}'.format(util, path)
|
||||||
utils[util] = path
|
utils[util] = path
|
||||||
@ -1480,4 +1505,12 @@ if __name__ == '__main__':
|
|||||||
print("%s %s" % (machine, human), end="\n")
|
print("%s %s" % (machine, human), end="\n")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
unittest.main(verbosity=2)
|
prog = unittest.main(verbosity=2, exit=False)
|
||||||
|
if prog.result.errors or prog.result.failures:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Translate to skip error
|
||||||
|
if prog.result.testsRun == len(prog.result.skipped):
|
||||||
|
sys.exit(77)
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|||||||
@ -39,6 +39,7 @@ foreach t: tests
|
|||||||
{
|
{
|
||||||
'name': t,
|
'name': t,
|
||||||
'file': files(meson.current_source_dir() / t + '.py')[0],
|
'file': files(meson.current_source_dir() / t + '.py')[0],
|
||||||
|
'is_parallel': false,
|
||||||
'env': [
|
'env': [
|
||||||
'TOPBUILDDIR=' + meson.build_root(),
|
'TOPBUILDDIR=' + meson.build_root(),
|
||||||
'TOPSRCDIR=' + meson.source_root(),
|
'TOPSRCDIR=' + meson.source_root(),
|
||||||
|
|||||||
@ -18,7 +18,9 @@ import subprocess
|
|||||||
import dbus
|
import dbus
|
||||||
import dbusmock
|
import dbusmock
|
||||||
import fcntl
|
import fcntl
|
||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import time
|
import time
|
||||||
import pypamtest
|
import pypamtest
|
||||||
|
|
||||||
@ -68,6 +70,9 @@ class TestPamFprintd(dbusmock.DBusTestCase):
|
|||||||
def tearDownClass(klass):
|
def tearDownClass(klass):
|
||||||
klass.stop_monitor()
|
klass.stop_monitor()
|
||||||
|
|
||||||
|
# Remove pam wrapper files, as they may break other tests
|
||||||
|
[shutil.rmtree(i) for i in glob.glob('/tmp/pam.[0-9A-z]')]
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
(self.p_mock, self.obj_fprintd_manager) = self.spawn_server_template(
|
(self.p_mock, self.obj_fprintd_manager) = self.spawn_server_template(
|
||||||
self.template_name, {}, stdout=subprocess.PIPE)
|
self.template_name, {}, stdout=subprocess.PIPE)
|
||||||
|
|||||||
Reference in New Issue
Block a user