Merge lp:~darkxst/ubuntu/raring/gnome-shell/lp1064584 into lp:ubuntu/raring/gnome-shell

Proposed by Tim Lunn
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~darkxst/ubuntu/raring/gnome-shell/lp1064584
Merge into: lp:ubuntu/raring/gnome-shell
Diff against target: 238 lines (+218/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/git_relock_screen_after_crash.patch (+210/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~darkxst/ubuntu/raring/gnome-shell/lp1064584
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+165828@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

I've uploaded this to raring-proposed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-04-22 08:38:14 +0000
3+++ debian/changelog 2013-05-27 07:15:36 +0000
4@@ -1,3 +1,10 @@
5+gnome-shell (3.6.3.1-0ubuntu6.1) raring; urgency=low
6+
7+ * debian/patches/git_relock_screen_after_crash.patch:
8+ - backport upstream patch to relock session after crash (LP: #1064584)
9+
10+ -- Tim Lunn <tim@feathertop.org> Mon, 27 May 2013 09:33:11 +1000
11+
12 gnome-shell (3.6.3.1-0ubuntu6) raring; urgency=low
13
14 * debian/patches:
15
16=== added file 'debian/patches/git_relock_screen_after_crash.patch'
17--- debian/patches/git_relock_screen_after_crash.patch 1970-01-01 00:00:00 +0000
18+++ debian/patches/git_relock_screen_after_crash.patch 2013-05-27 07:15:36 +0000
19@@ -0,0 +1,210 @@
20+From 90e0e3410b94c9b3221c881ea1af1e579249913e Mon Sep 17 00:00:00 2001
21+From: Colin Walters <walters@verbum.org>
22+Date: Thu, 17 Jan 2013 14:39:54 -0500
23+Subject: [PATCH] Re-lock the screen if we're restarted from a previously crashed shell
24+
25+This way we "fail closed", which is better for security.
26+
27+See https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/1064584
28+
29+https://bugzilla.gnome.org/show_bug.cgi?id=691987
30+---
31+ js/ui/main.js | 3 +
32+ js/ui/screenShield.js | 13 ++++++
33+ src/shell-global.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++
34+ src/shell-global.h | 8 ++++
35+ 4 files changed, 124 insertions(+), 0 deletions(-)
36+
37+--- a/js/ui/screenShield.js
38++++ b/js/ui/screenShield.js
39+@@ -28,6 +28,8 @@
40+ const LOCK_ENABLED_KEY = 'lock-enabled';
41+ const LOCK_DELAY_KEY = 'lock-delay';
42+
43++const LOCKED_STATE_STR = 'screenShield.locked';
44++
45+ const CURTAIN_SLIDE_TIME = 0.3;
46+ // fraction of screen height the arrow must reach before completing
47+ // the slide up automatically
48+@@ -882,6 +884,7 @@
49+ this._isActive = false;
50+ this._isLocked = false;
51+ this.emit('lock-status-changed');
52++ global.set_runtime_state(LOCKED_STATE_STR, null);
53+ },
54+
55+ lock: function(animate) {
56+@@ -905,11 +908,22 @@
57+ }
58+
59+ this._resetLockScreen(animate, animate);
60++ global.set_runtime_state(LOCKED_STATE_STR, GLib.Variant.new('b', true));
61+
62+ this._isActive = true;
63+ this._isLocked = true;
64+ this.emit('lock-status-changed');
65+ },
66++
67++ // If the previous shell crashed, and gnome-session restarted us, then re-lock
68++ lockIfWasLocked: function() {
69++ let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
70++ if (wasLocked === null)
71++ return;
72++ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
73++ this.lock(false);
74++ }));
75++ }
76+ });
77+ Signals.addSignalMethods(ScreenShield.prototype);
78+
79+--- a/src/shell-global.c
80++++ b/src/shell-global.c
81+@@ -82,6 +82,8 @@
82+ const char *userdatadir;
83+ StFocusManager *focus_manager;
84+
85++ GFile *runtime_state_path;
86++
87+ guint work_count;
88+ GSList *leisure_closures;
89+ guint leisure_function_id;
90+@@ -236,6 +238,8 @@
91+ const char *datadir = g_getenv ("GNOME_SHELL_DATADIR");
92+ const char *shell_js = g_getenv("GNOME_SHELL_JS");
93+ char *imagedir, **search_path;
94++ char *path;
95++ const char *byteorder_string;
96+
97+ if (!datadir)
98+ datadir = GNOME_SHELL_DATADIR;
99+@@ -258,6 +262,20 @@
100+ global->userdatadir = g_build_filename (g_get_user_data_dir (), "gnome-shell", NULL);
101+ g_mkdir_with_parents (global->userdatadir, 0700);
102+
103++#if G_BYTE_ORDER == G_LITTLE_ENDIAN
104++ byteorder_string = "LE";
105++#else
106++ byteorder_string = "BE";
107++#endif
108++
109++ /* And the runtime state */
110++ path = g_strdup_printf ("%s/gnome-shell/runtime-state-%s.%s",
111++ g_get_user_runtime_dir (),
112++ byteorder_string,
113++ XDisplayName (NULL));
114++ (void) g_mkdir_with_parents (path, 0700);
115++ global->runtime_state_path = g_file_new_for_path (path);
116++
117+ global->settings = g_settings_new ("org.gnome.shell");
118+
119+ global->grab_notifier = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
120+@@ -294,6 +312,8 @@
121+
122+ the_object = NULL;
123+
124++ g_clear_object (&global->runtime_state_path);
125++
126+ G_OBJECT_CLASS(shell_global_parent_class)->finalize (object);
127+ }
128+
129+@@ -1733,3 +1753,83 @@
130+ else
131+ return NULL;
132+ }
133++
134++static GFile *
135++get_runtime_state_path (ShellGlobal *global,
136++ const char *property_name)
137++{
138++ return g_file_get_child (global->runtime_state_path, property_name);
139++}
140++
141++/**
142++ * shell_global_set_runtime_state:
143++ * @global: a #ShellGlobal
144++ * @property_name: Name of the property
145++ * @variant: (allow-none): A #GVariant, or %NULL to unset
146++ *
147++ * Change the value of serialized runtime state.
148++ */
149++void
150++shell_global_set_runtime_state (ShellGlobal *global,
151++ const char *property_name,
152++ GVariant *variant)
153++{
154++ GFile *path;
155++
156++ path = get_runtime_state_path (global, property_name);
157++
158++ if (variant == NULL)
159++ (void) g_file_delete (path, NULL, NULL);
160++ else
161++ {
162++ gsize size = g_variant_get_size (variant);
163++ g_file_replace_contents (path, g_variant_get_data (variant), size,
164++ NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION,
165++ NULL, NULL, NULL);
166++ }
167++}
168++
169++/**
170++ * shell_global_get_runtime_state:
171++ * @global: a #ShellGlobal
172++ * @property_type: Expected data type
173++ * @property_name: Name of the property
174++ *
175++ * The shell maintains "runtime" state which does not persist across
176++ * logout or reboot.
177++ *
178++ * Returns: The value of a serialized property, or %NULL if none stored
179++ */
180++GVariant *
181++shell_global_get_runtime_state (ShellGlobal *global,
182++ const char *property_type,
183++ const char *property_name)
184++{
185++ GVariant *res = NULL;
186++ GMappedFile *mfile;
187++ GFile *path;
188++ char *pathstr;
189++ GError *local_error = NULL;
190++
191++ path = get_runtime_state_path (global, property_name);
192++ pathstr = g_file_get_path (path);
193++ mfile = g_mapped_file_new (pathstr, FALSE, &local_error);
194++ if (!mfile)
195++ {
196++ if (!g_error_matches (local_error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
197++ {
198++ g_warning ("Failed to open runtime state: %s", local_error->message);
199++ }
200++ g_clear_error (&local_error);
201++ }
202++ else
203++ {
204++ GBytes *bytes = g_mapped_file_get_bytes (mfile);
205++ res = g_variant_new_from_bytes ((GVariantType*)property_type, bytes, TRUE);
206++ g_bytes_unref (bytes);
207++ g_mapped_file_unref (mfile);
208++ }
209++
210++ out:
211++ return res;
212++}
213+--- a/src/shell-global.h
214++++ b/src/shell-global.h
215+@@ -138,6 +138,14 @@
216+
217+ ClutterActor * shell_global_create_xrootpmap_texture (ShellGlobal *global);
218+
219++void shell_global_set_runtime_state (ShellGlobal *global,
220++ const char *property_name,
221++ GVariant *variant);
222++GVariant * shell_global_get_runtime_state (ShellGlobal *global,
223++ const char *property_type,
224++ const char *property_name);
225++
226++
227+ G_END_DECLS
228+
229+ #endif /* __SHELL_GLOBAL_H__ */
230
231=== modified file 'debian/patches/series'
232--- debian/patches/series 2013-04-22 08:38:14 +0000
233+++ debian/patches/series 2013-05-27 07:15:36 +0000
234@@ -12,3 +12,4 @@
235 git_fix_dialog_activate_signals.patch
236 git_add_stylesheets_signal.patch
237 git_fix_theme_node_crash.patch
238+git_relock_screen_after_crash.patch

Subscribers

People subscribed via source and target branches

to all changes: