Commit a5f66339 authored by Ray Strode's avatar Ray Strode

Ensure keyboard grab and unlock dialog exist after monitor removal

gnome-screensaver currently doesn't deal with monitors getting
removed properly.  If the unlock dialog is on the removed monitor
then the unlock dialog and its associated keyboard grab are not
moved to an existing monitor when the monitor removal is processed.

This means that users can gain access to the locked system by placing
the mouse pointer on an external monitor and then disconnect the
external monitor.

CVE-2010-0414
https://bugzilla.gnome.org/show_bug.cgi?id=609337
parent f7d9f23a
......@@ -1495,6 +1495,9 @@ on_screen_monitors_changed (GdkScreen *screen,
gs_manager_create_window_for_monitor (manager, screen, i);
}
} else {
gdk_x11_grab_server ();
/* remove the extra windows */
l = manager->priv->windows;
while (l != NULL) {
......@@ -1512,6 +1515,16 @@ on_screen_monitors_changed (GdkScreen *screen,
}
l = next;
}
/* make sure there is a lock dialog on a connected monitor,
* and that the keyboard is still properly grabbed after all
* the windows above got destroyed*/
if (n_windows > n_monitors) {
gs_manager_request_unlock (manager);
}
gdk_flush ();
gdk_x11_ungrab_server ();
}
}
......
......@@ -45,6 +45,8 @@ static void gs_window_init (GSWindow *window);
static void gs_window_finalize (GObject *object);
static gboolean popup_dialog_idle (GSWindow *window);
static void gs_window_dialog_finish (GSWindow *window);
static void remove_command_watches (GSWindow *window);
enum {
DIALOG_RESPONSE_CANCEL,
......@@ -1021,6 +1023,21 @@ gs_window_destroy (GSWindow *window)
{
g_return_if_fail (GS_IS_WINDOW (window));
if (window->priv->lock_pid > 0) {
gs_window_dialog_finish (window);
}
remove_popup_dialog_idle (window);
remove_command_watches (window);
remove_watchdog_timer (window);
if (window->priv->lock_box != NULL) {
gtk_container_remove (GTK_CONTAINER (window->priv->vbox), GTK_WIDGET (window->priv->lock_box));
window->priv->lock_box = NULL;
g_signal_emit (window, signals [DIALOG_DOWN], 0);
}
gtk_widget_destroy (GTK_WIDGET (window));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment