diff options
author | Ray Strode <rstrode@redhat.com> | 2012-07-09 21:33:10 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2012-07-17 04:14:56 -0400 |
commit | 2853ce5812aa8f03f677516e64d5dcff1e6e01ab (patch) | |
tree | 9287b11efc20a033ca2d57a99d7046c607163e18 /daemon/gdm-dbus-util.c | |
parent | 4f86de30a115a77cf61b4652fef53f9f0517fc0b (diff) | |
download | gdm-2853ce5812aa8f03f677516e64d5dcff1e6e01ab.tar.gz |
worker: add reauthentication support
This commit adds reauthentication support for
screensavers and user switching to use.
1) It adds a "verification mode" argument to the GdmSession constructor
that tweaks the behavior of how the session worker acts to fit login or
unlock scenarios better.
2) It adds a way for programs to open a communication channel for user
verification to already runnings sessions (so reauthentication happens
in the context of the session).
Diffstat (limited to 'daemon/gdm-dbus-util.c')
-rw-r--r-- | daemon/gdm-dbus-util.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/daemon/gdm-dbus-util.c b/daemon/gdm-dbus-util.c index e57f0a0b..94361c66 100644 --- a/daemon/gdm-dbus-util.c +++ b/daemon/gdm-dbus-util.c @@ -163,3 +163,43 @@ gdm_dbus_get_pid_for_name (const char *system_bus_name, return retval; } + +gboolean +gdm_dbus_get_uid_for_name (const char *system_bus_name, + uid_t *out_uid, + GError **error) +{ + GDBusConnection *bus; + GVariant *reply; + gboolean retval = FALSE; + unsigned int v; + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error); + if (bus == NULL) { + return FALSE; + } + + reply = g_dbus_connection_call_sync (bus, + "org.freedesktop.DBus", + "/org/freedesktop/DBus", + "org.freedesktop.DBus", + "GetConnectionUnixUser", + g_variant_new ("(s)", system_bus_name), + G_VARIANT_TYPE ("(u)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, error); + if (reply == NULL) { + goto out; + } + + g_variant_get (reply, "(u)", &v); + *out_uid = v; + g_variant_unref (reply); + + retval = TRUE; + out: + g_object_unref (bus); + + return retval; +} |