From 0bba073dffabbd29a7b4c34ff8525e3a0bac1292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 8 Dec 2020 05:53:26 +0100 Subject: [PATCH] device: Handle data not-found error as verify-no-match In case we got a data-not-found error, it means that the device has not such prints stored, and thus the verification failed, and there's no need to expose the internal reasons to fprintd clients. --- src/device.c | 3 ++- tests/fprintd.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/device.c b/src/device.c index 5b65a24..628f2fd 100644 --- a/src/device.c +++ b/src/device.c @@ -611,7 +611,8 @@ verify_result_to_name (gboolean match, GError *error) */ if (g_error_matches (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_PROTO)) return "verify-disconnected"; - else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) || + g_error_matches (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_NOT_FOUND)) return "verify-no-match"; return "verify-unknown-error"; diff --git a/tests/fprintd.py b/tests/fprintd.py index 657fea6..0cf0d6e 100644 --- a/tests/fprintd.py +++ b/tests/fprintd.py @@ -2700,7 +2700,7 @@ class FPrintdVirtualDeviceVerificationTests(FPrintdVirtualDeviceBaseTest): self.assertVerifyError(FPrint.DeviceError.DATA_INVALID, 'verify-unknown-error') def test_verify_error_data_not_found(self): - self.assertVerifyError(FPrint.DeviceError.DATA_NOT_FOUND, 'verify-unknown-error') + self.assertVerifyError(FPrint.DeviceError.DATA_NOT_FOUND, 'verify-no-match') def test_verify_error_data_full(self): self.assertVerifyError(FPrint.DeviceError.DATA_FULL, 'verify-unknown-error')