[gnome-shell] GdmUtil: don't call GetUserVerifier from the user session



commit 48b70f358d8ac08558676c72d51ef6e8c1957bff
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Aug 3 17:10:45 2012 +0200

    GdmUtil: don't call GetUserVerifier from the user session
    
    GetUserVerifier can only be called from the greeter session,
    and fails with AccessDenied in all other cases. Also, calling it
    hides the real error from OpenReauthenticationChannel, which
    instead should be logged.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680750

 js/gdm/util.js        |   15 ++++++++++++++-
 js/ui/unlockDialog.js |    2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/js/gdm/util.js b/js/gdm/util.js
index b441b50..fb68ab0 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -7,6 +7,7 @@ const Signals = imports.signals;
 const Batch = imports.gdm.batch;
 const Fprint = imports.gdm.fingerprint;
 const Main = imports.ui.main;
+const Params = imports.misc.params;
 const Tweener = imports.ui.tweener;
 
 const PASSWORD_SERVICE_NAME = 'gdm-password';
@@ -69,7 +70,10 @@ function fadeOutActor(actor) {
 const ShellUserVerifier = new Lang.Class({
     Name: 'ShellUserVerifier',
 
-    _init: function(client) {
+    _init: function(client, params) {
+        params = Params.parse(params, { reauthenticationOnly: false });
+        this._reauthOnly = params.reauthenticationOnly;
+
         this._client = client;
 
         this._settings = new Gio.Settings({ schema: LOGIN_SCREEN_SCHEMA });
@@ -135,6 +139,15 @@ const ShellUserVerifier = new Lang.Class({
 
             this._hold.release();
         } catch (e) {
+            if (this._reauthOnly) {
+                logError(e, 'Failed to open reauthentication channel');
+
+                this._hold.release();
+                this.emit('verification-failed');
+
+                return;
+            }
+
             // If there's no session running, or it otherwise fails, then fall back
             // to performing verification from this login session
             client.get_user_verifier(this._cancellable, Lang.bind(this, this._userVerifierGot));
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 8dba006..af07a72 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -87,7 +87,7 @@ const UnlockDialog = new Lang.Class({
         this._user = this._userManager.get_user(this._userName);
 
         this._greeterClient = new Gdm.Client();
-        this._userVerifier = new GdmUtil.ShellUserVerifier(this._greeterClient);
+        this._userVerifier = new GdmUtil.ShellUserVerifier(this._greeterClient, { reauthenticationOnly: true });
 
         this._userVerifier.connect('reset', Lang.bind(this, this._reset));
         this._userVerifier.connect('ask-question', Lang.bind(this, this._onAskQuestion));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]