From: Michael Leibowitz Date: Thu, 27 Feb 2014 05:12:24 +0000 (-0800) Subject: start using smack processes X-Git-Tag: accepted/tizen/generic/20140227.074256^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_3.0.m14.3_ivi;p=platform%2Fupstream%2Fpolkit.git start using smack processes Change-Id: I8daa785f95b3ba7215a7d3c6f27cfdb35f4c8156 --- diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c index 2a297c4..30d35d6 100644 --- a/src/polkit/polkitsystembusname.c +++ b/src/polkit/polkitsystembusname.c @@ -29,6 +29,7 @@ #include "polkitprivate.h" #include "polkitunixprocess.h" +#include "polkitsmackprocess.h" /** * SECTION:polkitsystembusname @@ -360,6 +361,8 @@ polkit_system_bus_name_get_process_sync (PolkitSystemBusName *system_bus_name, PolkitSubject *ret; GVariant *result; guint32 pid; + guint32 uid; + char *label; g_return_val_if_fail (POLKIT_IS_SYSTEM_BUS_NAME (system_bus_name), NULL); g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); @@ -388,7 +391,43 @@ polkit_system_bus_name_get_process_sync (PolkitSystemBusName *system_bus_name, g_variant_get (result, "(u)", &pid); g_variant_unref (result); - ret = polkit_unix_process_new (pid); + result = g_dbus_connection_call_sync (connection, + "org.freedesktop.DBus", /* name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetConnectionUnixUser", /* method */ + g_variant_new ("(s)", system_bus_name->name), + G_VARIANT_TYPE ("(u)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (result == NULL) + goto out; + + g_variant_get (result, "(u)", &uid); + g_variant_unref (result); + + + + result = g_dbus_connection_call_sync (connection, + "org.freedesktop.DBus", /* name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetConnectionSmackContext", /* method */ + g_variant_new ("(s)", system_bus_name->name), + G_VARIANT_TYPE ("(s)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + + if (result == NULL) + goto out; + + g_variant_get (result, "(s)", &label); + g_variant_unref (result); + ret = polkit_smack_process_new_full (pid, 0, uid, label); out: if (connection != NULL)