From e0a643f3b98be5ca2236a3e6f986a5b7a95b0fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 17 Dec 2020 01:37:54 +0100 Subject: [PATCH] device: Return more specific error if we failed cleaning up the storage --- src/device.c | 22 ++++++++++++++-------- src/device.xml | 5 ++++- src/fprintd.h | 2 ++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/device.c b/src/device.c index d70f6a5..602a336 100644 --- a/src/device.c +++ b/src/device.c @@ -1919,10 +1919,13 @@ delete_enrolled_fingers (FprintDevice *rdev, { if ((r = store.print_data_delete (priv->dev, finger, user)) != 0) { - g_set_error (error, FPRINT_ERROR, FPRINT_ERROR_INTERNAL, - "Impossible to delete fingerprint reference " - "got error: %d", r); - return FALSE; + if (user_has_print_enrolled (rdev, user, finger)) + { + g_set_error (error, FPRINT_ERROR, FPRINT_ERROR_PRINTS_NOT_DELETED, + "Impossible to delete fingerprint reference " + "got error: %d", r); + return FALSE; + } } } else @@ -1936,10 +1939,13 @@ delete_enrolled_fingers (FprintDevice *rdev, if (local_error) continue; - g_set_error (&local_error, FPRINT_ERROR, FPRINT_ERROR_INTERNAL, - "Impossible to delete fingerprint reference " - "got error: %d", r); - /* Do not return yet, at least try to remove the remaining prints */ + if (user_has_print_enrolled (rdev, user, i)) + { + g_set_error (&local_error, FPRINT_ERROR, FPRINT_ERROR_PRINTS_NOT_DELETED, + "Impossible to delete fingerprint reference " + "got error: %d", r); + /* Do not return yet, at least try to remove the remaining prints */ + } } } diff --git a/src/device.xml b/src/device.xml index 2646d83..1a3479f 100644 --- a/src/device.xml +++ b/src/device.xml @@ -8,6 +8,7 @@ + ]> @@ -314,6 +315,7 @@ if the caller lacks the appropriate PolicyKit authorization + if the fingerprint is not deleted from fprintd storage @@ -330,6 +332,7 @@ if the caller lacks the appropriate PolicyKit authorization + if the fingerprint is not deleted from fprintd storage @@ -356,7 +359,7 @@ if the device was not claimed if the finger name passed is invalid if the chosen user doesn't have the requsted fingerprint enrolled - if there was an internal error + if the fingerprint is not deleted from fprintd storage diff --git a/src/fprintd.h b/src/fprintd.h index 3f99be5..dc45492 100644 --- a/src/fprintd.h +++ b/src/fprintd.h @@ -51,6 +51,8 @@ typedef enum { FPRINT_ERROR_INVALID_FINGERNAME, /*< nick=net.reactivated.Fprint.Error.InvalidFingername >*/ /* device does not exist */ FPRINT_ERROR_NO_SUCH_DEVICE, /*< nick=net.reactivated.Fprint.Error.NoSuchDevice >*/ + /* Prints cannot be deleted from the fprintd storage */ + FPRINT_ERROR_PRINTS_NOT_DELETED, /*< nick=net.reactivated.Fprint.Error.PrintsNotDeleted >*/ } FprintError; /* Enum of possible permissions, orders and nick matter here: