[sysprof/wip/chergert/sysprof-3] sysprofd: actually check authorization result



commit c09d2eefb562a3eb1d55feff582f33fbbc0e999b
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 17 14:36:42 2019 -0700

    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 163794e..c2d8ed2 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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]