[gdm] session: introduce new client-rejected signal



commit 559fa86ea593fcc89a23e76f41e0cd4520383698
Author: Ray Strode <rstrode redhat com>
Date:   Thu Apr 10 08:56:10 2014 -0400

    session: introduce new client-rejected signal
    
    If a client gets rejected because it's not allowed to connect
    to a particular session, we really need to inform the owner
    of the session object so it can do any clean up it needs to do,
    if necessary.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727982

 daemon/gdm-session.c |   24 ++++++++++++++++++++++++
 daemon/gdm-session.h |    1 +
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 723aecd..805072b 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -143,6 +143,7 @@ enum {
         SETUP_COMPLETE,
         CANCELLED,
         HOSTNAME_SELECTED,
+        CLIENT_REJECTED,
         CLIENT_CONNECTED,
         CLIENT_DISCONNECTED,
         CLIENT_READY_FOR_SESSION_TO_START,
@@ -1563,6 +1564,7 @@ allow_user_function (GDBusAuthObserver *observer,
                      GdmSession        *self)
 {
         uid_t client_uid;
+        GPid  pid_of_client;
 
         client_uid = g_credentials_get_unix_user (credentials, NULL);
         if (client_uid == self->priv->allowed_user) {
@@ -1571,6 +1573,15 @@ allow_user_function (GDBusAuthObserver *observer,
 
         g_debug ("GdmSession: User not allowed");
 
+        pid_of_client = g_credentials_get_unix_pid (credentials, NULL);
+        g_signal_emit (G_OBJECT (self),
+                       signals [CLIENT_REJECTED],
+                       0,
+                       credentials,
+                       (guint)
+                       pid_of_client);
+
+
         return FALSE;
 }
 
@@ -3259,6 +3270,19 @@ gdm_session_class_init (GdmSessionClass *session_class)
                               G_TYPE_NONE,
                               0);
 
+        signals [CLIENT_REJECTED] =
+                g_signal_new ("client-rejected",
+                              GDM_TYPE_SESSION,
+                              G_SIGNAL_RUN_FIRST,
+                              G_STRUCT_OFFSET (GdmSessionClass, client_rejected),
+                              NULL,
+                              NULL,
+                              NULL,
+                              G_TYPE_NONE,
+                              2,
+                              G_TYPE_CREDENTIALS,
+                              G_TYPE_UINT);
+
         signals [CLIENT_CONNECTED] =
                 g_signal_new ("client-connected",
                               GDM_TYPE_SESSION,
diff --git a/daemon/gdm-session.h b/daemon/gdm-session.h
index 8bc8a57..fe2eb53 100644
--- a/daemon/gdm-session.h
+++ b/daemon/gdm-session.h
@@ -78,6 +78,7 @@ typedef struct
                                                     gboolean      client_is_ready);
 
         void (* cancelled)                   (GdmSession   *session);
+        void (* client_rejected)             (GdmSession   *session);
         void (* client_connected)            (GdmSession   *session);
         void (* client_disconnected)         (GdmSession   *session);
         void (* disconnected)                (GdmSession   *session);


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