r38478 - in /desktop/experimental/gnome-shell/debian: changelog patches/git_relock_screen_after_crash.patch patches/series

jbicha-guest at users.alioth.debian.org jbicha-guest at users.alioth.debian.org
Sat Jun 8 18:16:53 UTC 2013


Author: jbicha-guest
Date: Sat Jun  8 18:16:52 2013
New Revision: 38478

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=38478
Log:
* debian/patches/git_relock_screen_after_crash.patch:
  + Backport fix to ensure session is locked after crash

Added:
    desktop/experimental/gnome-shell/debian/patches/git_relock_screen_after_crash.patch
Modified:
    desktop/experimental/gnome-shell/debian/changelog
    desktop/experimental/gnome-shell/debian/patches/series

Modified: desktop/experimental/gnome-shell/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/gnome-shell/debian/changelog?rev=38478&op=diff
==============================================================================
--- desktop/experimental/gnome-shell/debian/changelog [utf-8] (original)
+++ desktop/experimental/gnome-shell/debian/changelog [utf-8] Sat Jun  8 18:16:52 2013
@@ -1,9 +1,14 @@
 gnome-shell (3.8.3-2) UNRELEASED; urgency=low
 
+  [ Emilio Pozuelo Monfort ]
   * debian/control.in:
     + Add gkbd-capplet back to gnome-shell's recommends. It was dropped
       in 3.7.92-1 but the shell's keyboard layout switcher uses it to
       display the layout in a window.
+
+  [ Jeremy Bicha ]
+  * debian/patches/git_relock_screen_after_crash.patch:
+    + Backport fix to ensure session is locked after crash
 
  -- Emilio Pozuelo Monfort <pochu at debian.org>  Sat, 08 Jun 2013 19:45:09 +0200
 

Added: desktop/experimental/gnome-shell/debian/patches/git_relock_screen_after_crash.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/gnome-shell/debian/patches/git_relock_screen_after_crash.patch?rev=38478&op=file
==============================================================================
--- desktop/experimental/gnome-shell/debian/patches/git_relock_screen_after_crash.patch (added)
+++ desktop/experimental/gnome-shell/debian/patches/git_relock_screen_after_crash.patch [utf-8] Sat Jun  8 18:16:52 2013
@@ -1,0 +1,234 @@
+From 90e0e3410b94c9b3221c881ea1af1e579249913e Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters at verbum.org>
+Date: Thu, 17 Jan 2013 14:39:54 -0500
+Subject: [PATCH] Re-lock the screen if we're restarted from a previously crashed shell
+
+This way we "fail closed", which is better for security.
+
+See https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/1064584
+
+https://bugzilla.gnome.org/show_bug.cgi?id=691987
+---
+ js/ui/main.js         |    3 +
+ js/ui/screenShield.js |   13 ++++++
+ src/shell-global.c    |  100 +++++++++++++++++++++++++++++++++++++++++++++++++
+ src/shell-global.h    |    8 ++++
+ 4 files changed, 124 insertions(+), 0 deletions(-)
+
+diff --git a/js/ui/main.js b/js/ui/main.js
+index b4e4687..ea28848 100644
+--- a/js/ui/main.js
++++ b/js/ui/main.js
+@@ -212,6 +212,9 @@ function _initializeUI() {
+                               if (keybindingMode == Shell.KeyBindingMode.NONE) {
+                                   keybindingMode = Shell.KeyBindingMode.NORMAL;
+                               }
++                              if (screenShield) {
++                                  screenShield.lockIfWasLocked();
++                              }
+                           });
+ }
+ 
+diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
+index cfd55b9..0416670 100644
+--- a/js/ui/screenShield.js
++++ b/js/ui/screenShield.js
+@@ -30,6 +30,7 @@ const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
+ const LOCK_ENABLED_KEY = 'lock-enabled';
+ const LOCK_DELAY_KEY = 'lock-delay';
+ 
++const LOCKED_STATE_STR = 'screenShield.locked';
+ // fraction of screen height the arrow must reach before completing
+ // the slide up automatically
+ const ARROW_DRAG_THRESHOLD = 0.1;
+@@ -1173,6 +1174,7 @@ const ScreenShield = new Lang.Class({
+         this._isLocked = false;
+         this.emit('active-changed');
+         this.emit('locked-changed');
++        global.set_runtime_state(LOCKED_STATE_STR, null);
+     },
+ 
+     activate: function(animate) {
+@@ -1189,6 +1191,7 @@ const ScreenShield = new Lang.Class({
+         }
+ 
+         this._resetLockScreen(animate, animate);
++        global.set_runtime_state(LOCKED_STATE_STR, GLib.Variant.new('b', true));
+ 
+         // We used to set isActive and emit active-changed here,
+         // but now we do that from lockScreenShown, which means
+@@ -1215,5 +1218,15 @@ const ScreenShield = new Lang.Class({
+ 
+         this.emit('locked-changed');
+     },
++
++    // If the previous shell crashed, and gnome-session restarted us, then re-lock
++    lockIfWasLocked: function() {
++        let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
++        if (wasLocked === null)
++            return;
++        Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
++            this.lock(false);
++        }));
++    }
+ });
+ Signals.addSignalMethods(ScreenShield.prototype);
+diff --git a/src/shell-global.c b/src/shell-global.c
+index 889e146..b8a3b42 100644
+--- a/src/shell-global.c
++++ b/src/shell-global.c
+@@ -82,6 +82,8 @@ struct _ShellGlobal {
+   const char *userdatadir;
+   StFocusManager *focus_manager;
+ 
++  GFile *runtime_state_path;
++
+   guint work_count;
+   GSList *leisure_closures;
+   guint leisure_function_id;
+@@ -236,6 +238,8 @@ shell_global_init (ShellGlobal *global)
+   const char *datadir = g_getenv ("GNOME_SHELL_DATADIR");
+   const char *shell_js = g_getenv("GNOME_SHELL_JS");
+   char *imagedir, **search_path;
++  char *path;
++  const char *byteorder_string;
+ 
+   if (!datadir)
+     datadir = GNOME_SHELL_DATADIR;
+@@ -258,6 +262,20 @@ shell_global_init (ShellGlobal *global)
+   global->userdatadir = g_build_filename (g_get_user_data_dir (), "gnome-shell", NULL);
+   g_mkdir_with_parents (global->userdatadir, 0700);
+ 
++#if G_BYTE_ORDER == G_LITTLE_ENDIAN
++  byteorder_string = "LE";
++#else
++  byteorder_string = "BE";
++#endif
++
++  /* And the runtime state */
++  path = g_strdup_printf ("%s/gnome-shell/runtime-state-%s.%s",
++                          g_get_user_runtime_dir (),
++                          byteorder_string,
++                          XDisplayName (NULL));
++  (void) g_mkdir_with_parents (path, 0700);
++  global->runtime_state_path = g_file_new_for_path (path);
++
+   global->settings = g_settings_new ("org.gnome.shell");
+   
+   global->grab_notifier = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
+@@ -299,6 +317,8 @@ shell_global_finalize (GObject *object)
+ 
+   the_object = NULL;
+ 
++  g_clear_object (&global->runtime_state_path);
++
+   G_OBJECT_CLASS(shell_global_parent_class)->finalize (object);
+ }
+ 
+@@ -1779,3 +1799,83 @@ shell_global_get_session_mode (ShellGlobal *global)
+ 
+   return global->session_mode;
+ }
++
++static GFile *
++get_runtime_state_path (ShellGlobal  *global,
++                        const char   *property_name)
++{
++  return g_file_get_child (global->runtime_state_path, property_name);
++}
++
++/**
++ * shell_global_set_runtime_state:
++ * @global: a #ShellGlobal
++ * @property_name: Name of the property
++ * @variant: (allow-none): A #GVariant, or %NULL to unset
++ *
++ * Change the value of serialized runtime state.
++ */
++void
++shell_global_set_runtime_state (ShellGlobal  *global,
++                                const char   *property_name,
++                                GVariant     *variant)
++{
++  GFile *path;
++
++  path = get_runtime_state_path (global, property_name);
++
++  if (variant == NULL)
++    (void) g_file_delete (path, NULL, NULL);
++  else
++    {
++      gsize size = g_variant_get_size (variant);
++      g_file_replace_contents (path, g_variant_get_data (variant), size,
++                               NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION,
++                               NULL, NULL, NULL);
++    }
++}
++
++/**
++ * shell_global_get_runtime_state:
++ * @global: a #ShellGlobal
++ * @property_type: Expected data type
++ * @property_name: Name of the property
++ *
++ * The shell maintains "runtime" state which does not persist across
++ * logout or reboot.
++ *
++ * Returns: The value of a serialized property, or %NULL if none stored
++ */
++GVariant *
++shell_global_get_runtime_state (ShellGlobal  *global,
++                                const char   *property_type,
++                                const char   *property_name)
++{
++  GVariant *res = NULL;
++  GMappedFile *mfile;
++  GFile *path;
++  char *pathstr;
++  GError *local_error = NULL;
++
++  path = get_runtime_state_path (global, property_name);
++  pathstr = g_file_get_path (path);
++  mfile = g_mapped_file_new (pathstr, FALSE, &local_error);
++  if (!mfile)
++    {
++      if (!g_error_matches (local_error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
++        {
++          g_warning ("Failed to open runtime state: %s", local_error->message);
++        }
++      g_clear_error (&local_error);
++    }
++  else
++    {
++      GBytes *bytes = g_mapped_file_get_bytes (mfile);
++      res = g_variant_new_from_bytes ((GVariantType*)property_type, bytes, TRUE);
++      g_bytes_unref (bytes);
++      g_mapped_file_unref (mfile);
++    }
++
++ out:
++  return res;
++}
+diff --git a/src/shell-global.h b/src/shell-global.h
+index a8df0f5..1be447c 100644
+--- a/src/shell-global.h
++++ b/src/shell-global.h
+@@ -150,6 +150,14 @@ void     shell_global_reexec_self               (ShellGlobal  *global);
+ 
+ const char *     shell_global_get_session_mode  (ShellGlobal  *global);
+ 
++void     shell_global_set_runtime_state      (ShellGlobal  *global,
++                                              const char   *property_name,
++                                              GVariant     *variant);
++GVariant * shell_global_get_runtime_state       (ShellGlobal  *global,
++                                                 const char   *property_type,
++                                                 const char   *property_name);
++
++
+ G_END_DECLS
+ 
+ #endif /* __SHELL_GLOBAL_H__ */
+-- 
+1.7.1
+
+

Modified: desktop/experimental/gnome-shell/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/gnome-shell/debian/patches/series?rev=38478&op=diff
==============================================================================
--- desktop/experimental/gnome-shell/debian/patches/series [utf-8] (original)
+++ desktop/experimental/gnome-shell/debian/patches/series [utf-8] Sat Jun  8 18:16:52 2013
@@ -3,3 +3,4 @@
 #30-remoteMenu-Prevent-the-shell-from-becoming-unrespons.patch
 40_change-pam-name-to-match-gdm.patch
 revert-suspend-break.patch
+git_relock_screen_after_crash.patch




More information about the pkg-gnome-commits mailing list