[gdm] Use g_credentials_get_unix_pid() instead of home baked function
- From: Laurent Bigonville <lbigon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] Use g_credentials_get_unix_pid() instead of home baked function
- Date: Mon, 11 Nov 2013 17:14:48 +0000 (UTC)
commit 87f181489983bb8d640a6a227caa8cbfc0fff853
Author: Laurent Bigonville <bigon bigon be>
Date: Mon Nov 11 00:21:37 2013 +0100
Use g_credentials_get_unix_pid() instead of home baked function
This function is available in GIO since 2.36
Thanks to Petr Salinger <Petr Salinger seznam cz> for the patch
Debian Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692739
https://bugzilla.gnome.org/show_bug.cgi?id=687921
configure.ac | 2 +-
daemon/gdm-session.c | 28 +++-------------------------
2 files changed, 4 insertions(+), 26 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bffc88b..0008c62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,7 +63,7 @@ dnl ---------------------------------------------------------------------------
dnl - Dependencies
dnl ---------------------------------------------------------------------------
-GLIB_REQUIRED_VERSION=2.35.0
+GLIB_REQUIRED_VERSION=2.36.0
GTK_REQUIRED_VERSION=2.91.1
LIBCANBERRA_GTK_REQUIRED_VERSION=0.4
ACCOUNTS_SERVICE_REQUIRED_VERSION=0.6.12
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index d74bed6..b2d931d 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -970,28 +970,6 @@ allow_worker_function (GDBusAuthObserver *observer,
return FALSE;
}
-static GPid
-credentials_get_unix_pid (GCredentials *credentials)
-{
- GPid pid = 0;
- gpointer native_credentials = NULL;
-
-#ifdef __linux__
- native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_LINUX_UCRED);
- pid = (GPid) ((struct ucred *) native_credentials)->pid;
-#elif defined (__FreeBSD__)
- native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED);
- pid = (GPid) ((struct cmsgcred *) native_credentials)->cmcred_pid;
-#elif defined (__OpenBSD__)
- native_credentials = g_credentials_get_native (credentials, G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED);
- pid = (GPid) ((struct sockpeercred *) native_credentials)->pid;
-#else
-#error "platform not supported, need mechanism to detect pid of connected process"
-#endif
-
- return pid;
-}
-
static gboolean
register_worker (GdmDBusWorkerManager *worker_manager_interface,
GDBusMethodInvocation *invocation,
@@ -1021,7 +999,7 @@ register_worker (GdmDBusWorkerManager *worker_manager_interface,
connection_node);
credentials = g_dbus_connection_get_peer_credentials (connection);
- pid = credentials_get_unix_pid (credentials);
+ pid = g_credentials_get_unix_pid (credentials, NULL);
conversation = find_conversation_by_pid (self, (GPid) pid);
@@ -1479,7 +1457,7 @@ on_outside_connection_closed (GDBusConnection *connection,
connection);
credentials = g_dbus_connection_get_peer_credentials (connection);
- pid_of_client = credentials_get_unix_pid (credentials);
+ pid_of_client = g_credentials_get_unix_pid (credentials, NULL);
g_signal_emit (G_OBJECT (self),
signals [CLIENT_DISCONNECTED],
@@ -1531,7 +1509,7 @@ handle_connection_from_outside (GDBusServer *server,
}
credentials = g_dbus_connection_get_peer_credentials (connection);
- pid_of_client = credentials_get_unix_pid (credentials);
+ pid_of_client = g_credentials_get_unix_pid (credentials, NULL);
g_signal_emit (G_OBJECT (self),
signals [CLIENT_CONNECTED],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]