device: Always return FALSE if setting an error in Check claimed

We may have a case where the sender matches with the
session's sender but have a session invocation already set.

In such case we set an error, but still return TRUE.
This commit is contained in:
Marco Trevisan (Treviño)
2020-12-03 18:23:36 +01:00
committed by Benjamin Berg
parent 29f34cf23c
commit a92b8e5f60

View File

@ -473,7 +473,6 @@ _fprint_device_check_claimed (FprintDevice *rdev,
FprintDevicePrivate *priv = fprint_device_get_instance_private(rdev); FprintDevicePrivate *priv = fprint_device_get_instance_private(rdev);
g_autoptr(SessionData) session = NULL; g_autoptr(SessionData) session = NULL;
const char *sender; const char *sender;
gboolean retval;
if (requested_state == STATE_IGNORED) if (requested_state == STATE_IGNORED)
return TRUE; return TRUE;
@ -501,14 +500,14 @@ _fprint_device_check_claimed (FprintDevice *rdev,
} }
sender = g_dbus_method_invocation_get_sender (invocation); sender = g_dbus_method_invocation_get_sender (invocation);
retval = g_str_equal (sender, session->sender);
if (retval == FALSE || session->invocation != NULL) { if (!g_str_equal (sender, session->sender) || session->invocation != NULL) {
g_set_error (error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE, g_set_error (error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE,
_("Device already in use by another user")); _("Device already in use by another user"));
return FALSE;
} }
return retval; return TRUE;
} }
static gboolean static gboolean