[nemiver/profiler: 48/48] Fined-grained authorization checks



commit 30436d4116d9e4598f373a210b78e2646e57a149
Author: Fabien Parent <parent f gmail com>
Date:   Wed Aug 15 11:36:08 2012 +0200

    Fined-grained authorization checks

 src/profengine/nmv-perf-server.cc |   38 ++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 13 deletions(-)
---
diff --git a/src/profengine/nmv-perf-server.cc b/src/profengine/nmv-perf-server.cc
index 60f7bc8..1779b88 100644
--- a/src/profengine/nmv-perf-server.cc
+++ b/src/profengine/nmv-perf-server.cc
@@ -213,19 +213,7 @@ struct PerfServer::Priv {
             THROW_IF_FAIL (a_invocation);
 
             Glib::ustring bus_name = a_invocation->get_sender ();
-
-            PolkitAuthorizationResult *result =
-                polkit_authority_check_authorization_sync
-                    (polkit_authority_get_sync (NULL, NULL),
-                     polkit_system_bus_name_new (bus_name.c_str ()),
-                     "org.gnome.nemiver.profiler.profile-running-process",
-                     NULL,
-                     POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
-                     NULL,
-                     NULL);
-            THROW_IF_FAIL (result);
-            THROW_IF_FAIL
-                (polkit_authorization_result_get_is_authorized (result));
+            PolkitAuthorizationResult *result = 0;
 
             if(a_request_name == "ProfileSystem") {
                 Glib::Variant<int> uid_param;
@@ -233,6 +221,18 @@ struct PerfServer::Priv {
                 a_parameters.get_child (uid_param, 5);
                 a_parameters.get_child (gid_param, 6);
 
+                result = polkit_authority_check_authorization_sync
+                    (polkit_authority_get_sync (0, 0),
+                     polkit_system_bus_name_new (bus_name.c_str ()),
+                     "org.gnome.nemiver.profiler.profile-system",
+                     0,
+                     POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+                     0,
+                     0);
+                THROW_IF_FAIL (result);
+                THROW_IF_FAIL
+                    (polkit_authorization_result_get_is_authorized (result));
+
                 RequestInfo request;
                 request.uid = uid_param.get ();
                 request.gid = gid_param.get ();
@@ -262,6 +262,18 @@ struct PerfServer::Priv {
                 a_parameters.get_child (uid_param, 5);
                 a_parameters.get_child (gid_param, 6);
 
+                result = polkit_authority_check_authorization_sync
+                    (polkit_authority_get_sync (0, 0),
+                     polkit_system_bus_name_new (bus_name.c_str ()),
+                     "org.gnome.nemiver.profiler.profile-running-process",
+                     0,
+                     POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+                     0,
+                     0);
+                THROW_IF_FAIL (result);
+                THROW_IF_FAIL
+                    (polkit_authorization_result_get_is_authorized (result));
+
                 RequestInfo request;
 
                 int pid = pid_param.get ();



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