* Thu Aug 19 2010 Bastien Nocera <bnocera@redhat.com> 0.2.0-1

- Update to 0.2.0
This commit is contained in:
Bastien Nocera 2010-08-19 17:17:15 +01:00
parent 30a1cca5d8
commit 51050917bc
5 changed files with 8 additions and 808 deletions

View File

@ -1,228 +0,0 @@
From c94c8b437a9a1ce46fda7b14220a4737b30a8fae Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 27 Jan 2009 12:29:23 +0000
Subject: [PATCH] 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.
---
pam/pam_fprintd.c | 8 ++++++--
src/device.c | 40 ++++++++++++++++++++++++++++++++++++----
src/device.xml | 13 +++++++++++++
tests/verify.c | 2 +-
4 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/pam/pam_fprintd.c b/pam/pam_fprintd.c
index 9847f4a..5e8757c 100644
--- a/pam/pam_fprintd.c
+++ b/pam/pam_fprintd.c
@@ -154,7 +154,7 @@ static DBusGProxy *create_manager (pam_handle_t *pamh, DBusGConnection **ret_con
return manager;
}
-static close_and_unref (DBusGConnection *connection)
+static void close_and_unref (DBusGConnection *connection)
{
DBusConnection *conn;
@@ -335,7 +335,11 @@ static int do_verify(GMainLoop *loop, pam_handle_t *pamh, DBusGProxy *dev)
ret = PAM_SUCCESS;
else if (g_str_equal (data->result, "verify-unknown-error"))
ret = PAM_AUTHINFO_UNAVAIL;
- else {
+ else if (g_str_equal (data->result, "verify-disconnected")) {
+ ret = PAM_AUTHINFO_UNAVAIL;
+ g_free (data->result);
+ break;
+ } else {
send_info_msg (data->pamh, "An unknown error occured");
ret = PAM_AUTH_ERR;
g_free (data->result);
diff --git a/src/device.c b/src/device.c
index 68a0b52..e1127da 100644
--- a/src/device.c
+++ b/src/device.c
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <pwd.h>
+#include <errno.h>
#include "fprintd-marshal.h"
#include "fprintd.h"
@@ -119,6 +120,8 @@ struct FprintDevicePrivate {
FprintDeviceAction current_action;
/* Whether we should ignore new signals on the device */
gboolean action_done;
+ /* Whether the device was disconnected */
+ gboolean disconnected;
};
typedef struct FprintDevicePrivate FprintDevicePrivate;
@@ -368,6 +371,8 @@ verify_result_to_name (int result)
return "verify-finger-not-centered";
case FP_VERIFY_RETRY_REMOVE_FINGER:
return "verify-remove-and-retry";
+ case -EPROTO:
+ return "verify-disconnected";
default:
return "verify-unknown-error";
}
@@ -391,11 +396,21 @@ enroll_result_to_name (int result)
return "enroll-finger-not-centered";
case FP_ENROLL_RETRY_REMOVE_FINGER:
return "enroll-remove-and-retry";
+ case -EPROTO:
+ return "enroll-disconnected";
default:
return "enroll-unknown-error";
}
}
+static void
+set_disconnected (FprintDevicePrivate *priv, const char *res)
+{
+ if (g_str_equal (res, "enroll-disconnected") ||
+ g_str_equal (res, "verify-disconnected"))
+ priv->disconnected = TRUE;
+}
+
static gboolean
_fprint_device_check_claimed (FprintDevice *rdev,
DBusGMethodInvocation *context,
@@ -790,6 +805,7 @@ static void verify_cb(struct fp_dev *dev, int r, struct fp_img *img,
if (r == FP_VERIFY_NO_MATCH || r == FP_VERIFY_MATCH || r < 0)
priv->action_done = TRUE;
+ set_disconnected (priv, name);
g_signal_emit(rdev, signals[SIGNAL_VERIFY_STATUS], 0, name, priv->action_done);
fp_img_free(img);
@@ -813,6 +829,7 @@ static void identify_cb(struct fp_dev *dev, int r,
if (r == FP_VERIFY_NO_MATCH || r == FP_VERIFY_MATCH || r < 0)
priv->action_done = TRUE;
+ set_disconnected (priv, name);
g_signal_emit(rdev, signals[SIGNAL_VERIFY_STATUS], 0, name, priv->action_done);
fp_img_free(img);
@@ -986,7 +1003,10 @@ static void fprint_device_verify_stop(FprintDevice *rdev,
fp_print_data_free (priv->verify_data);
priv->verify_data = NULL;
}
- r = fp_async_verify_stop(priv->dev, verify_stop_cb, context);
+ if (!priv->disconnected)
+ r = fp_async_verify_stop(priv->dev, verify_stop_cb, context);
+ else
+ r = 0;
} else if (priv->current_action == ACTION_IDENTIFY) {
if (priv->identify_data != NULL) {
guint i;
@@ -995,7 +1015,10 @@ static void fprint_device_verify_stop(FprintDevice *rdev,
g_free (priv->identify_data);
priv->identify_data = NULL;
}
- r = fp_async_identify_stop(priv->dev, identify_stop_cb, context);
+ if (!priv->disconnected)
+ r = fp_async_identify_stop(priv->dev, identify_stop_cb, context);
+ else
+ r = 0;
} else {
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_NO_ACTION_IN_PROGRESS,
"No verification in progress");
@@ -1010,6 +1033,8 @@ static void fprint_device_verify_stop(FprintDevice *rdev,
dbus_g_method_return_error(context, error);
g_error_free (error);
}
+ if (priv->disconnected)
+ dbus_g_method_return(context);
priv->current_action = ACTION_NONE;
}
@@ -1020,6 +1045,7 @@ static void enroll_stage_cb(struct fp_dev *dev, int result,
struct FprintDevice *rdev = user_data;
FprintDevicePrivate *priv = DEVICE_GET_PRIVATE(rdev);
struct session_data *session = priv->session;
+ const char *name = enroll_result_to_name (result);
int r;
/* We're done, ignore new events for the action */
@@ -1035,8 +1061,9 @@ static void enroll_stage_cb(struct fp_dev *dev, int result,
if (result == FP_ENROLL_COMPLETE || result == FP_ENROLL_FAIL || result < 0)
priv->action_done = TRUE;
+ set_disconnected (priv, name);
- g_signal_emit(rdev, signals[SIGNAL_ENROLL_STATUS], 0, enroll_result_to_name (result), priv->action_done);
+ g_signal_emit(rdev, signals[SIGNAL_ENROLL_STATUS], 0, name, priv->action_done);
fp_img_free(img);
fp_print_data_free(print);
@@ -1129,13 +1156,18 @@ static void fprint_device_enroll_stop(FprintDevice *rdev,
return;
}
- r = fp_async_enroll_stop(priv->dev, enroll_stop_cb, context);
+ if (!priv->disconnected)
+ r = fp_async_enroll_stop(priv->dev, enroll_stop_cb, context);
+ else
+ r = 0;
if (r < 0) {
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_INTERNAL,
"Enroll stop failed with error %d", r);
dbus_g_method_return_error(context, error);
g_error_free (error);
}
+ if (priv->disconnected)
+ dbus_g_method_return(context);
priv->current_action = ACTION_NONE;
}
diff --git a/src/device.xml b/src/device.xml
index 402c44b..99912ad 100644
--- a/src/device.xml
+++ b/src/device.xml
@@ -183,6 +183,12 @@
</doc:definition>
</doc:item>
<doc:item>
+ <doc:term>verify-disconnected</doc:term>
+ <doc:definition>
+ The device was disconnected during the verification, no other actions should be taken, and you shouldn't use the device any more.
+ </doc:definition>
+ </doc:item>
+ <doc:item>
<doc:term>verify-unknown-error</doc:term>
<doc:definition>
An unknown error occurred (usually a driver problem), <doc:ref type="method" to="Device.VerifyStop">Device.VerifyStop</doc:ref> should now be called.
@@ -240,6 +246,13 @@
</doc:definition>
</doc:item>
<doc:item>
+ <doc:term>enroll-disconnected</doc:term>
+ <doc:definition>
+ The device was disconnected during the enrollment, no other actions should be taken, and you shouldn't use the device any more.
+
+ </doc:definition>
+ </doc:item>
+ <doc:item>
<doc:term>enroll-unknown-error</doc:term>
<doc:definition>
An unknown error occurred (usually a driver problem), <doc:ref type="method" to="Device.EnrollStop">Device.EnrollStop</doc:ref> should now be called.
diff --git a/tests/verify.c b/tests/verify.c
index 999c402..eb739cb 100644
--- a/tests/verify.c
+++ b/tests/verify.c
@@ -100,7 +100,7 @@ static void find_finger(DBusGProxy *dev, const char *username)
static void verify_result(GObject *object, const char *result, gboolean done, void *user_data)
{
gboolean *verify_completed = user_data;
- g_print("Verify result: %s\n", result);
+ g_print("Verify result: %s (%s)\n", result, done ? "done" : "not done");
if (done != FALSE)
*verify_completed = TRUE;
}
--
1.6.0.6

View File

@ -1,299 +0,0 @@
From d4eef9303d28565dcfdcde63becf6d610594bce8 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 9 Dec 2009 13:15:57 +0000
Subject: [PATCH] Remove all use of g_error()
Otherwise we get bug reports about crashers that aren't crashers.
---
tests/delete.c | 26 +++++++++++++++++---------
tests/enroll.c | 36 ++++++++++++++++++++++++------------
tests/list.c | 26 +++++++++++++++++---------
tests/verify.c | 42 ++++++++++++++++++++++++++++--------------
4 files changed, 86 insertions(+), 44 deletions(-)
diff --git a/tests/delete.c b/tests/delete.c
index b6e58de..38dccfb 100644
--- a/tests/delete.c
+++ b/tests/delete.c
@@ -31,8 +31,10 @@ static void create_manager(void)
GError *error = NULL;
connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
- if (connection == NULL)
- g_error("Failed to connect to session bus: %s", error->message);
+ if (connection == NULL) {
+ g_print("Failed to connect to session bus: %s\n", error->message);
+ exit (1);
+ }
manager = dbus_g_proxy_new_for_name(connection,
"net.reactivated.Fprint", "/net/reactivated/Fprint/Manager",
@@ -47,14 +49,18 @@ static void delete_fingerprints(DBusGProxy *dev, const char *username)
p = dbus_g_proxy_new_from_proxy(dev, "org.freedesktop.DBus.Properties", NULL);
if (!dbus_g_proxy_call (p, "GetAll", &error, G_TYPE_STRING, "net.reactivated.Fprint.Device", G_TYPE_INVALID,
- dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &props, G_TYPE_INVALID))
- g_error("GetAll on the Properties interface failed: %s", error->message);
+ dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &props, G_TYPE_INVALID)) {
+ g_print("GetAll on the Properties interface failed: %s\n", error->message);
+ exit (1);
+ }
if (!net_reactivated_Fprint_Device_delete_enrolled_fingers(dev, username, &error)) {
- if (dbus_g_error_has_name (error, "net.reactivated.Fprint.Error.NoEnrolledPrints") == FALSE)
- g_error("ListEnrolledFingers failed: %s", error->message);
- else
+ if (dbus_g_error_has_name (error, "net.reactivated.Fprint.Error.NoEnrolledPrints") == FALSE) {
+ g_print("ListEnrolledFingers failed: %s\n", error->message);
+ exit (1);
+ } else {
g_print ("No fingerprints to delete on %s\n", g_value_get_string (g_hash_table_lookup (props, "name")));
+ }
} else {
g_print ("Fingerprints deleted on %s\n", g_value_get_string (g_hash_table_lookup (props, "name")));
}
@@ -69,8 +75,10 @@ static void process_devices(char **argv)
char *path;
guint i;
- if (!net_reactivated_Fprint_Manager_get_devices(manager, &devices, &error))
- g_error("list_devices failed: %s", error->message);
+ if (!net_reactivated_Fprint_Manager_get_devices(manager, &devices, &error)) {
+ g_print("list_devices failed: %s\n", error->message);
+ exit (1);
+ }
if (devices->len == 0) {
g_print("No devices found\n");
diff --git a/tests/enroll.c b/tests/enroll.c
index e7da3b3..260fb17 100644
--- a/tests/enroll.c
+++ b/tests/enroll.c
@@ -31,8 +31,10 @@ static void create_manager(void)
GError *error = NULL;
connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
- if (connection == NULL)
- g_error("Failed to connect to session bus: %s", error->message);
+ if (connection == NULL) {
+ g_print("Failed to connect to session bus: %s\n", error->message);
+ exit (1);
+ }
manager = dbus_g_proxy_new_for_name(connection,
"net.reactivated.Fprint", "/net/reactivated/Fprint/Manager",
@@ -45,8 +47,10 @@ static DBusGProxy *open_device(const char *username)
gchar *path;
DBusGProxy *dev;
- if (!net_reactivated_Fprint_Manager_get_default_device(manager, &path, &error))
- g_error("list_devices failed: %s", error->message);
+ if (!net_reactivated_Fprint_Manager_get_default_device(manager, &path, &error)) {
+ g_print("list_devices failed: %s\n", error->message);
+ exit (1);
+ }
if (path == NULL) {
g_print("No devices found\n");
@@ -61,8 +65,10 @@ static DBusGProxy *open_device(const char *username)
g_free (path);
- if (!net_reactivated_Fprint_Device_claim(dev, username, &error))
- g_error("failed to claim device: %s", error->message);
+ if (!net_reactivated_Fprint_Device_claim(dev, username, &error)) {
+ g_print("failed to claim device: %s\n", error->message);
+ exit (1);
+ }
return dev;
}
@@ -84,8 +90,10 @@ static void do_enroll(DBusGProxy *dev)
&enroll_completed, NULL);
g_print("Enrolling right index finger.\n");
- if (!net_reactivated_Fprint_Device_enroll_start(dev, "right-index-finger", &error))
- g_error("EnrollStart failed: %s", error->message);
+ if (!net_reactivated_Fprint_Device_enroll_start(dev, "right-index-finger", &error)) {
+ g_print("EnrollStart failed: %s\n", error->message);
+ exit (1);
+ }
while (!enroll_completed)
g_main_context_iteration(NULL, TRUE);
@@ -93,15 +101,19 @@ static void do_enroll(DBusGProxy *dev)
dbus_g_proxy_disconnect_signal(dev, "EnrollStatus",
G_CALLBACK(enroll_result), &enroll_completed);
- if (!net_reactivated_Fprint_Device_enroll_stop(dev, &error))
- g_error("VerifyStop failed: %s", error->message);
+ if (!net_reactivated_Fprint_Device_enroll_stop(dev, &error)) {
+ g_print("VerifyStop failed: %s\n", error->message);
+ exit(1);
+ }
}
static void release_device(DBusGProxy *dev)
{
GError *error = NULL;
- if (!net_reactivated_Fprint_Device_release(dev, &error))
- g_error("ReleaseDevice failed: %s", error->message);
+ if (!net_reactivated_Fprint_Device_release(dev, &error)) {
+ g_print("ReleaseDevice failed: %s\n", error->message);
+ exit (1);
+ }
}
int main(int argc, char **argv)
diff --git a/tests/list.c b/tests/list.c
index 561b05a..074457e 100644
--- a/tests/list.c
+++ b/tests/list.c
@@ -31,8 +31,10 @@ static void create_manager(void)
GError *error = NULL;
connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
- if (connection == NULL)
- g_error("Failed to connect to session bus: %s", error->message);
+ if (connection == NULL) {
+ g_print("Failed to connect to session bus: %s\n", error->message);
+ exit (1);
+ }
manager = dbus_g_proxy_new_for_name(connection,
"net.reactivated.Fprint", "/net/reactivated/Fprint/Manager",
@@ -48,16 +50,20 @@ static void list_fingerprints(DBusGProxy *dev, const char *username)
guint i;
if (!net_reactivated_Fprint_Device_list_enrolled_fingers(dev, username, &fingers, &error)) {
- if (dbus_g_error_has_name (error, "net.reactivated.Fprint.Error.NoEnrolledPrints") == FALSE)
- g_error("ListEnrolledFingers failed: %s", error->message);
- else
+ if (dbus_g_error_has_name (error, "net.reactivated.Fprint.Error.NoEnrolledPrints") == FALSE) {
+ g_print("ListEnrolledFingers failed: %s\n", error->message);
+ exit (1);
+ } else {
fingers = NULL;
+ }
}
p = dbus_g_proxy_new_from_proxy(dev, "org.freedesktop.DBus.Properties", NULL);
if (!dbus_g_proxy_call (p, "GetAll", &error, G_TYPE_STRING, "net.reactivated.Fprint.Device", G_TYPE_INVALID,
- dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &props, G_TYPE_INVALID))
- g_error("GetAll on the Properties interface failed: %s", error->message);
+ dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &props, G_TYPE_INVALID)) {
+ g_print("GetAll on the Properties interface failed: %s\n", error->message);
+ exit (1);
+ }
if (fingers == NULL || g_strv_length (fingers) == 0) {
g_print("User %s has no fingers enrolled for %s.\n", username, g_value_get_string (g_hash_table_lookup (props, "name")));
@@ -85,8 +91,10 @@ static void process_devices(char **argv)
char *path;
guint i;
- if (!net_reactivated_Fprint_Manager_get_devices(manager, &devices, &error))
- g_error("list_devices failed: %s", error->message);
+ if (!net_reactivated_Fprint_Manager_get_devices(manager, &devices, &error)) {
+ g_print("list_devices failed: %s\n", error->message);
+ exit (1);
+ }
if (devices->len == 0) {
g_print("No devices found\n");
diff --git a/tests/verify.c b/tests/verify.c
index eb739cb..69be220 100644
--- a/tests/verify.c
+++ b/tests/verify.c
@@ -36,8 +36,10 @@ static void create_manager(void)
GError *error = NULL;
connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
- if (connection == NULL)
- g_error("Failed to connect to session bus: %s", error->message);
+ if (connection == NULL) {
+ g_print("Failed to connect to session bus: %s\n", error->message);
+ exit (1);
+ }
manager = dbus_g_proxy_new_for_name(connection,
"net.reactivated.Fprint", "/net/reactivated/Fprint/Manager",
@@ -50,8 +52,10 @@ static DBusGProxy *open_device(const char *username)
gchar *path;
DBusGProxy *dev;
- if (!net_reactivated_Fprint_Manager_get_default_device(manager, &path, &error))
- g_error("list_devices failed: %s", error->message);
+ if (!net_reactivated_Fprint_Manager_get_default_device(manager, &path, &error)) {
+ g_print("list_devices failed: %s\n", error->message);
+ exit (1);
+ }
if (path == NULL) {
g_print("No devices found\n");
@@ -66,8 +70,10 @@ static DBusGProxy *open_device(const char *username)
g_free (path);
- if (!net_reactivated_Fprint_Device_claim(dev, username, &error))
- g_error("failed to claim device: %s", error->message);
+ if (!net_reactivated_Fprint_Device_claim(dev, username, &error)) {
+ g_print("failed to claim device: %s\n", error->message);
+ exit (1);
+ }
return dev;
}
@@ -78,8 +84,10 @@ static void find_finger(DBusGProxy *dev, const char *username)
char **fingers;
guint i;
- if (!net_reactivated_Fprint_Device_list_enrolled_fingers(dev, username, &fingers, &error))
- g_error("ListEnrolledFingers failed: %s", error->message);
+ if (!net_reactivated_Fprint_Device_list_enrolled_fingers(dev, username, &fingers, &error)) {
+ g_print("ListEnrolledFingers failed: %s\n", error->message);
+ exit (1);
+ }
if (fingers == NULL || g_strv_length (fingers) == 0) {
g_print("No fingers enrolled for this device.\n");
@@ -122,8 +130,10 @@ static void do_verify(DBusGProxy *dev)
dbus_g_proxy_connect_signal(dev, "VerifyFingerSelected", G_CALLBACK(verify_finger_selected),
NULL, NULL);
- if (!net_reactivated_Fprint_Device_verify_start(dev, finger_name, &error))
- g_error("VerifyStart failed: %s", error->message);
+ if (!net_reactivated_Fprint_Device_verify_start(dev, finger_name, &error)) {
+ g_print("VerifyStart failed: %s\n", error->message);
+ exit (1);
+ }
while (!verify_completed)
g_main_context_iteration(NULL, TRUE);
@@ -131,15 +141,19 @@ static void do_verify(DBusGProxy *dev)
dbus_g_proxy_disconnect_signal(dev, "VerifyStatus", G_CALLBACK(verify_result), &verify_completed);
dbus_g_proxy_disconnect_signal(dev, "VerifyFingerSelected", G_CALLBACK(verify_finger_selected), NULL);
- if (!net_reactivated_Fprint_Device_verify_stop(dev, &error))
- g_error("VerifyStop failed: %s", error->message);
+ if (!net_reactivated_Fprint_Device_verify_stop(dev, &error)) {
+ g_print("VerifyStop failed: %s\n", error->message);
+ exit (1);
+ }
}
static void release_device(DBusGProxy *dev)
{
GError *error = NULL;
- if (!net_reactivated_Fprint_Device_release(dev, &error))
- g_error("ReleaseDevice failed: %s", error->message);
+ if (!net_reactivated_Fprint_Device_release(dev, &error)) {
+ g_print("ReleaseDevice failed: %s\n", error->message);
+ exit (1);
+ }
}
static const GOptionEntry entries[] = {
--
1.6.5.2

View File

@ -1,24 +1,11 @@
%define long_hash 04fd09cfa88718838e02f4419befc1a0dd4b5a0e
%define short_hash 04fd09cfa
Name: fprintd
Version: 0.1
Release: 16.git%{short_hash}%{?dist}
Version: 0.2.0
Release: 1%{?dist}
Summary: D-Bus service for Fingerprint reader access
Group: System Environment/Daemons
License: GPLv2+
# git clone git://projects.reactivated.net/~dsd/fprintd.git
# cd fprintd
# git reset --hard %{long_hash}
# ./autogen.sh && make distcheck
# mv fprintd-0.1.tar.bz2 fprintd-0.1-%{short_hash}.tar.bz2
Source0: fprintd-0.1-%{short_hash}.tar.bz2
Patch1: 0001-Detect-when-a-device-is-disconnected.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=498368
Patch2: polkit1.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=543194
Patch3: 0001-Remove-all-use-of-g_error.patch
Source0: http://freedesktop.org/~hadess/%{name}-%{version}.tar.bz2
Url: http://www.reactivated.net/fprint/wiki/Fprintd
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
ExcludeArch: s390 s390x
@ -63,11 +50,6 @@ fingerprint readers access.
%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1 -b .polkit1
%patch3 -p1 -b .g_error
autoreconf -i -f
%build
%configure --libdir=/%{_lib}/ --enable-gtk-doc --enable-pam
@ -95,6 +77,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dbus-1/system-services/net.reactivated.Fprint.service
%{_datadir}/polkit-1/actions/net.reactivated.fprint.device.policy
%{_localstatedir}/lib/fprint
%{_mandir}/man1/fprintd.1.gz
%files pam
%defattr(-,root,root,-)
@ -108,6 +91,9 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/dbus-1/interfaces/net.reactivated.Fprint.Manager.xml
%changelog
* Thu Aug 19 2010 Bastien Nocera <bnocera@redhat.com> 0.2.0-1
- Update to 0.2.0
* Wed Dec 09 2009 Bastien Nocera <bnocera@redhat.com> 0.1-16.git04fd09cfa
- Remove use of g_error(), or people think that it crashes when we actually
abort() (#543194)

View File

@ -1,259 +0,0 @@
diff -up fprintd-0.1/configure.ac.polkit1 fprintd-0.1/configure.ac
--- fprintd-0.1/configure.ac.polkit1 2008-11-22 09:34:59.000000000 -0500
+++ fprintd-0.1/configure.ac 2009-05-13 18:09:05.064187014 -0400
@@ -22,7 +22,7 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 dbus-gl
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
-PKG_CHECK_MODULES(DAEMON, glib-2.0 dbus-glib-1 gmodule-2.0 polkit >= 0.8 polkit-dbus)
+PKG_CHECK_MODULES(DAEMON, glib-2.0 dbus-glib-1 gmodule-2.0 polkit-gobject-1 >= 0.91)
AC_SUBST(DAEMON_LIBS)
AC_SUBST(DAEMON_CFLAGS)
@@ -45,9 +45,6 @@ AC_MSG_CHECKING(for PAM headers and libr
AC_MSG_RESULT([$has_pam])
-AC_CHECK_PROG([POLKIT_POLICY_FILE_VALIDATE],
- [polkit-policy-file-validate], [polkit-policy-file-validate])
-
AC_PATH_PROG([XSLTPROC], [xsltproc])
GTK_DOC_CHECK([1.3])
diff -up fprintd-0.1/data/Makefile.am.polkit1 fprintd-0.1/data/Makefile.am
--- fprintd-0.1/data/Makefile.am.polkit1 2008-11-22 09:34:59.000000000 -0500
+++ fprintd-0.1/data/Makefile.am 2009-05-13 18:09:05.065186384 -0400
@@ -9,7 +9,7 @@ $(dbus_services_DATA): $(dbus_services_i
dbus_confdir = $(sysconfdir)/dbus-1/system.d
dbus_conf_DATA = net.reactivated.Fprint.conf
-polkitdir = $(datadir)/PolicyKit/policy
+polkitdir = $(datadir)/polkit-1/actions
polkit_in_files = net.reactivated.fprint.device.policy.in
@INTLTOOL_POLICY_RULE@
@@ -21,7 +21,3 @@ conf_DATA = fprintd.conf
EXTRA_DIST = $(dbus_services_in_files) $(dbus_conf_DATA) $(polkit_in_files) $(conf_DATA)
CLEANFILES = $(polkit_DATA) $(dbus_services_DATA)
-check:
- $(POLKIT_POLICY_FILE_VALIDATE) $(polkit_DATA)
-
-
diff -up fprintd-0.1/data/net.reactivated.fprint.device.policy.in.polkit1 fprintd-0.1/data/net.reactivated.fprint.device.policy.in
--- fprintd-0.1/data/net.reactivated.fprint.device.policy.in.polkit1 2008-11-22 09:34:59.000000000 -0500
+++ fprintd-0.1/data/net.reactivated.fprint.device.policy.in 2009-05-13 18:09:05.065186384 -0400
@@ -35,7 +35,7 @@
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
- <allow_active>auth_admin_keep_always</allow_active>
+ <allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
diff -up fprintd-0.1/pam/Makefile.am.polkit1 fprintd-0.1/pam/Makefile.am
--- fprintd-0.1/pam/Makefile.am.polkit1 2009-01-26 05:35:54.000000000 -0500
+++ fprintd-0.1/pam/Makefile.am 2009-05-13 18:09:05.068186099 -0400
@@ -1,12 +1,12 @@
if HAVE_PAM
-pammod_PROGRAMS = pam_fprintd.so
+pammod_LTLIBRARIES = pam_fprintd.la
pammoddir=$(libdir)/security
-pam_fprintd_so_SOURCES = pam_fprintd.c $(MARSHALFILES)
-pam_fprintd_so_CFLAGS = -fPIC $(WARN_CFLAGS) $(GLIB_CFLAGS)
-pam_fprintd_so_LDFLAGS = -shared
-pam_fprintd_so_LDADD = $(PAM_LIBS) $(GLIB_LIBS)
+pam_fprintd_la_SOURCES = pam_fprintd.c $(MARSHALFILES)
+pam_fprintd_la_CFLAGS = -fPIC $(WARN_CFLAGS) $(GLIB_CFLAGS)
+pam_fprintd_la_LDFLAGS = -avoid-version -module
+pam_fprintd_la_LIBADD = $(PAM_LIBS) $(GLIB_LIBS)
MARSHALFILES = marshal.c marshal.h
GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
diff -up fprintd-0.1/src/device.c.polkit1 fprintd-0.1/src/device.c
--- fprintd-0.1/src/device.c.polkit1 2009-05-13 18:09:05.047196683 -0400
+++ fprintd-0.1/src/device.c 2009-05-13 18:10:05.449188670 -0400
@@ -23,7 +23,6 @@
#include <dbus/dbus-glib-lowlevel.h>
#include <glib/gi18n.h>
#include <polkit/polkit.h>
-#include <polkit-dbus/polkit-dbus.h>
#include <libfprint/fprint.h>
#include <sys/types.h>
@@ -96,7 +95,7 @@ struct FprintDevicePrivate {
struct fp_dev *dev;
struct session_data *session;
- PolKitContext *pol_ctx;
+ PolkitAuthority *auth;
/* The current user of the device, if claimed */
char *sender;
@@ -266,53 +265,13 @@ static void fprint_device_class_init(Fpr
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}
-static gboolean
-pk_io_watch_have_data (GIOChannel *channel, GIOCondition condition, gpointer user_data)
-{
- int fd;
- PolKitContext *pk_context = user_data;
- fd = g_io_channel_unix_get_fd (channel);
- polkit_context_io_func (pk_context, fd);
- return TRUE;
-}
-
-static int
-pk_io_add_watch (PolKitContext *pk_context, int fd)
-{
- guint id = 0;
- GIOChannel *channel;
- channel = g_io_channel_unix_new (fd);
- if (channel == NULL)
- goto out;
- id = g_io_add_watch (channel, G_IO_IN, pk_io_watch_have_data, pk_context);
- if (id == 0) {
- g_io_channel_unref (channel);
- goto out;
- }
- g_io_channel_unref (channel);
-out:
- return id;
-}
-
-static void
-pk_io_remove_watch (PolKitContext *pk_context, int watch_id)
-{
- g_source_remove (watch_id);
-}
-
static void fprint_device_init(FprintDevice *device)
{
FprintDevicePrivate *priv = DEVICE_GET_PRIVATE(device);
priv->id = ++last_id;
/* Setup PolicyKit */
- priv->pol_ctx = polkit_context_new ();
- polkit_context_set_io_watch_functions (priv->pol_ctx, pk_io_add_watch, pk_io_remove_watch);
- if (!polkit_context_init (priv->pol_ctx, NULL)) {
- g_critical ("cannot initialize libpolkit");
- polkit_context_unref (priv->pol_ctx);
- priv->pol_ctx = NULL;
- }
+ priv->auth = polkit_authority_get ();
priv->clients = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
@@ -449,28 +408,14 @@ _fprint_device_check_polkit_for_action (
{
FprintDevicePrivate *priv = DEVICE_GET_PRIVATE(rdev);
const char *sender;
- DBusError dbus_error;
- PolKitCaller *pk_caller;
- PolKitAction *pk_action;
- PolKitResult pk_result;
- uid_t uid;
+ PolkitSubject *subject;
+ PolkitAuthorizationResult *result;
/* Check that caller is privileged */
sender = dbus_g_method_get_sender (context);
- dbus_error_init (&dbus_error);
- pk_caller = polkit_caller_new_from_dbus_name (
- dbus_g_connection_get_connection (fprintd_dbus_conn),
- sender,
- &dbus_error);
- if (pk_caller == NULL) {
- g_set_error (error, FPRINT_ERROR,
- FPRINT_ERROR_INTERNAL,
- "Error getting information about caller: %s: %s",
- dbus_error.name, dbus_error.message);
- dbus_error_free (&dbus_error);
- return FALSE;
- }
+ subject = polkit_system_bus_name_new (sender);
+#if 0
/* XXX Hack?
* We'd like to allow root to set the username by default, so
* it can authenticate users through PAM
@@ -481,24 +426,26 @@ _fprint_device_check_polkit_for_action (
polkit_caller_unref (pk_caller);
return TRUE;
}
+#endif
- pk_action = polkit_action_new ();
- polkit_action_set_action_id (pk_action, action);
- pk_result = polkit_context_is_caller_authorized (priv->pol_ctx, pk_action, pk_caller,
- TRUE, NULL);
- polkit_caller_unref (pk_caller);
- polkit_action_unref (pk_action);
+ result = polkit_authority_check_authorization_sync (priv->auth,
+ subject,
+ action,
+ NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+ NULL, NULL);
+ g_object_unref (subject);
- if (pk_result != POLKIT_RESULT_YES) {
+ if (!polkit_authorization_result_get_is_authorized (result)) {
g_set_error (error, FPRINT_ERROR,
FPRINT_ERROR_PERMISSION_DENIED,
- "%s %s <-- (action, result)",
- action,
- polkit_result_to_string_representation (pk_result));
- dbus_error_free (&dbus_error);
+ "Not Authorized: %s", action);
+ g_object_unref (result);
return FALSE;
}
+ g_object_unref (result);
+
return TRUE;
}
@@ -1095,6 +1042,7 @@ static void fprint_device_enroll_start(F
}
if (_fprint_device_check_polkit_for_action (rdev, context, "net.reactivated.fprint.device.enroll", &error) == FALSE) {
+ g_print ("enroll not allowed: %s\n", error->message);
dbus_g_method_return_error (context, error);
return;
}
diff -up fprintd-0.1/src/net.reactivated.Fprint.Device.xml.polkit1 fprintd-0.1/src/net.reactivated.Fprint.Device.xml
--- fprintd-0.1/src/net.reactivated.Fprint.Device.xml.polkit1 2009-01-26 05:31:45.000000000 -0500
+++ fprintd-0.1/src/net.reactivated.Fprint.Device.xml 2009-05-13 18:09:05.071212005 -0400
@@ -183,6 +183,12 @@
</doc:definition>
</doc:item>
<doc:item>
+ <doc:term>verify-disconnected</doc:term>
+ <doc:definition>
+ The device was disconnected during the verification, no other actions should be taken, and you shouldn't use the device any more.
+ </doc:definition>
+ </doc:item>
+ <doc:item>
<doc:term>verify-unknown-error</doc:term>
<doc:definition>
An unknown error occurred (usually a driver problem), <doc:ref type="method" to="Device.VerifyStop">Device.VerifyStop</doc:ref> should now be called.
@@ -240,6 +246,13 @@
</doc:definition>
</doc:item>
<doc:item>
+ <doc:term>enroll-disconnected</doc:term>
+ <doc:definition>
+ The device was disconnected during the enrollment, no other actions should be taken, and you shouldn't use the device any more.
+
+ </doc:definition>
+ </doc:item>
+ <doc:item>
<doc:term>enroll-unknown-error</doc:term>
<doc:definition>
An unknown error occurred (usually a driver problem), <doc:ref type="method" to="Device.EnrollStop">Device.EnrollStop</doc:ref> should now be called.

View File

@ -1 +1 @@
13a47aec00b7e9f42f524fe5e6a2695b fprintd-0.1-04fd09cfa.tar.bz2
d6f023e6560d5647eadf668cdbcee57a fprintd-0.2.0.tar.bz2