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-18 17:34:16 -0500
commit3b6695247eb6de7330f8d1ea7ce41b94f0185cab (patch)
tree02ec38db29dc2dbbea86f31efe7debc1199ff212
parentec374187b14e0c03591383a1bedd31d725ff114d (diff)
downloadgdm-3b6695247eb6de7330f8d1ea7ce41b94f0185cab.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. https://bugzilla.gnome.org/show_bug.cgi?id=744764
-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 c8f38f16..6bdb1fc3 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -107,6 +107,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,
@@ -1005,6 +1006,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;
@@ -1307,6 +1311,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,
@@ -1782,6 +1793,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 5d306822..297129b6 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1581,21 +1581,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,