From 7688308f86f41d34b4d4feacf050873548e4d6d9 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 11 Dec 2018 16:50:47 +0000 Subject: [PATCH] lib: Fix handling of accountsservice queries for missing users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we ported to using FindUserById, it returns an explicit Failed error if a user doesn’t exist. Previously, we would guess at the user’s object path and call a method on it, and would receive a D-Bus ‘method not found’ error in response if the user didn’t exist. Correctly handle the explicit error from FindUserById. Signed-off-by: Philip Withnall https://phabricator.endlessm.com/T24004 --- libeos-parental-controls/app-filter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libeos-parental-controls/app-filter.c b/libeos-parental-controls/app-filter.c index 33ee9d7..7bf08a7 100644 --- a/libeos-parental-controls/app-filter.c +++ b/libeos-parental-controls/app-filter.c @@ -509,7 +509,8 @@ bus_error_to_app_filter_error (const GError *bus_error, return g_error_new (EPC_APP_FILTER_ERROR, EPC_APP_FILTER_ERROR_PERMISSION_DENIED, _("Not allowed to query app filter data for user %u"), user_id); - else if (g_error_matches (bus_error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) + else if (g_error_matches (bus_error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD) || + bus_remote_error_matches (bus_error, "org.freedesktop.Accounts.Error.Failed")) return g_error_new (EPC_APP_FILTER_ERROR, EPC_APP_FILTER_ERROR_INVALID_USER, _("User %u does not exist"), user_id); else