summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2015-02-17 17:22:57 -0500
committerRay Strode <rstrode@redhat.com>2015-02-17 23:48:09 -0500
commit75f446d48f2decdbed76e6040e191b06d2876692 (patch)
tree81f8238de99287fe17858b6af9c57c3ed0e7dea4
parent9c6d843b25936875b3548cb450389c70b498c04e (diff)
downloadgdm-75f446d48f2decdbed76e6040e191b06d2876692.tar.gz
display: only add user authorization if connected to display
If we aren't connected to the display then we can't give the user access to it,(and we don't need to anyway) This commit adds a new is-connected property to GdmDisplay and changes the code to never give a user authorization if we aren't connected.
-rw-r--r--daemon/gdm-display.c15
-rw-r--r--daemon/gdm-manager.c27
2 files changed, 31 insertions, 11 deletions
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 6b2a95ac..4069c6b4 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -106,6 +106,7 @@ enum {
PROP_X11_DISPLAY_NAME,
PROP_X11_COOKIE,
PROP_X11_AUTHORITY_FILE,
+ PROP_IS_CONNECTED,
PROP_IS_LOCAL,
PROP_LAUNCH_ENVIRONMENT,
PROP_IS_INITIAL,
@@ -1001,6 +1002,9 @@ gdm_display_get_property (GObject *object,
case PROP_IS_LOCAL:
g_value_set_boolean (value, self->priv->is_local);
break;
+ case PROP_IS_CONNECTED:
+ g_value_set_boolean (value, self->priv->x11_display != NULL);
+ break;
case PROP_LAUNCH_ENVIRONMENT:
g_value_set_object (value, self->priv->launch_environment);
break;
@@ -1302,6 +1306,13 @@ gdm_display_class_init (GdmDisplayClass *klass)
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
+ PROP_IS_CONNECTED,
+ g_param_spec_boolean ("is-connected",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READABLE));
+ g_object_class_install_property (object_class,
PROP_HAVE_EXISTING_USER_ACCOUNTS,
g_param_spec_boolean ("have-existing-user-accounts",
NULL,
@@ -1772,6 +1783,10 @@ gdm_display_connect (GdmDisplay *self)
ret = TRUE;
}
+ if (ret == TRUE) {
+ g_object_notify (G_OBJECT (self), "is-connected");
+ }
+
return ret;
}
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 42aa6351..6c030b85 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1573,21 +1573,26 @@ start_user_session (GdmManager *manager,
if (display != NULL) {
char *auth_file;
const char *username;
+ gboolean is_connected = FALSE;
- auth_file = NULL;
- username = gdm_session_get_username (operation->session);
- gdm_display_add_user_authorization (display,
- username,
- &auth_file,
- NULL);
+ g_object_get (G_OBJECT (display), "is-connected", &is_connected, NULL);
- g_assert (auth_file != NULL);
+ if (is_connected) {
+ auth_file = NULL;
+ username = gdm_session_get_username (operation->session);
+ gdm_display_add_user_authorization (display,
+ username,
+ &auth_file,
+ NULL);
+
+ g_assert (auth_file != NULL);
- g_object_set (operation->session,
- "user-x11-authority-file", auth_file,
- NULL);
+ g_object_set (operation->session,
+ "user-x11-authority-file", auth_file,
+ NULL);
- g_free (auth_file);
+ g_free (auth_file);
+ }
}
gdm_session_start_session (operation->session,