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
This commit is contained in:
Colin Walters
2013-01-17 14:39:54 -05:00
parent 727e4c0b37
commit ccfa3d3be1
4 changed files with 124 additions and 0 deletions

View File

@ -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;
@ -1175,6 +1176,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) {
@ -1191,6 +1193,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
@ -1217,5 +1220,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);