summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2021-07-01 12:53:05 +0200
committerBenjamin Berg <bberg@redhat.com>2021-07-01 13:10:41 +0200
commit59d2fbdabd90c69ddeb01d5bb77257e66097488a (patch)
treeea4cc68ba958f31176df0357ae201c45887c7460
parentb760a82ac68177516bd0a36656a3d2c040e8fcf7 (diff)
Revert "device: Delete existing print in EnrollStart"benzea/revert-print-deletion-in-enroll
This reverts commit 5c06660215a1d1482a143bcf68029c2838608fa8. Instead we will throw an error. The reason to not push this into an earlier release was that this is an API incompatible change and clients will need to be updated.
-rw-r--r--src/device.c22
-rw-r--r--tests/fprintd.py16
2 files changed, 11 insertions, 27 deletions
diff --git a/src/device.c b/src/device.c
index 49cbdd5..010bfc5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -54,11 +54,6 @@ static gboolean action_authorization_handler (GDBusInterfaceSkeleton *,
GDBusMethodInvocation *,
gpointer user_data);
-static gboolean delete_enrolled_fingers (FprintDevice *rdev,
- const char *user,
- FpFinger finger,
- GError **error);
-
static GQuark quark_auth_user = 0;
typedef enum {
@@ -1984,19 +1979,20 @@ fprint_device_enroll_start (FprintDBusDevice *dbus_dev,
store.print_data_load (priv->dev, finger,
session->username, &existing_print);
- if (!can_start_action (rdev, &error))
+ if (existing_print)
{
- g_dbus_method_invocation_return_gerror (invocation, error);
+ g_set_error (&error, FPRINT_ERROR, FPRINT_ERROR_FINGER_ALREADY_ENROLLED,
+ "Finger %d has already been enrolled for user %s", finger, session->username);
+ g_dbus_method_invocation_return_gerror (invocation,
+ error);
return TRUE;
}
- if (existing_print)
+
+ if (!can_start_action (rdev, &error))
{
- if (!delete_enrolled_fingers (rdev, session->username, finger, &error))
- {
- g_dbus_method_invocation_return_gerror (invocation, error);
- return TRUE;
- }
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return TRUE;
}
g_debug ("start enrollment device %d finger %d", priv->id, finger);
diff --git a/tests/fprintd.py b/tests/fprintd.py
index 1f8faee..e35ac88 100644
--- a/tests/fprintd.py
+++ b/tests/fprintd.py
@@ -2315,21 +2315,9 @@ class FPrintdVirtualDeviceEnrollTests(FPrintdVirtualDeviceBaseTest):
def test_enroll_already_enrolled_finger(self):
self.enroll_image('whorl', start=False)
- # We can enroll a new image deleting the first
- self.device.EnrollStart('(s)', 'left-middle-finger')
- self.enroll_image('arch', start=False)
self.stop_on_teardown = False
-
- # If we verify, 'arch' will match, 'whorl' will not match
- self.device.VerifyStart('(s)', 'any')
- self.send_image('whorl')
- self.assertVerifyNoMatch()
- self.device.VerifyStop()
-
- self.device.VerifyStart('(s)', 'any')
- self.send_image('arch')
- self.assertVerifyMatch()
- self.device.VerifyStop()
+ with self.assertFprintError('FingerAlreadyEnrolled'):
+ self.device.EnrollStart('(s)', 'left-middle-finger')
def test_enroll_duplicate_image(self):
self.enroll_image('whorl', finger='left-thumb', start=False)