From 931112b195ef109836a82d9c00487986315515dd Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 17 May 2019 14:36:42 -0700 Subject: [PATCH] sysprofd: actually check authorization result --- src/sysprofd/ipc-service-impl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sysprofd/ipc-service-impl.c b/src/sysprofd/ipc-service-impl.c index 163794e5..c2d8ed29 100644 --- a/src/sysprofd/ipc-service-impl.c +++ b/src/sysprofd/ipc-service-impl.c @@ -201,6 +201,7 @@ static gboolean ipc_service_impl_g_authorize_method (GDBusInterfaceSkeleton *skeleton, GDBusMethodInvocation *invocation) { + PolkitAuthorizationResult *res = NULL; PolkitAuthority *authority = NULL; PolkitSubject *subject = NULL; const gchar *peer_name; @@ -213,13 +214,14 @@ ipc_service_impl_g_authorize_method (GDBusInterfaceSkeleton *skeleton, if (!(authority = polkit_authority_get_sync (NULL, NULL)) || !(subject = polkit_system_bus_name_new (peer_name)) || - !polkit_authority_check_authorization_sync (authority, + !(res = polkit_authority_check_authorization_sync (authority, POLKIT_SUBJECT (subject), "org.gnome.sysprof3.profile", NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, NULL, - NULL)) + NULL)) || + !polkit_authorization_result_get_is_authorized (res)) { g_dbus_method_invocation_return_error (g_steal_pointer (&invocation), G_DBUS_ERROR, @@ -230,6 +232,7 @@ ipc_service_impl_g_authorize_method (GDBusInterfaceSkeleton *skeleton, g_clear_object (&authority); g_clear_object (&subject); + g_clear_object (&res); return ret; }