From a56d508d6977ada57298000ce317cdee5a3a954e Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 28 Apr 2021 10:36:46 -0400 Subject: [PATCH 1/5] authPrompt: Don't clear querying service unless querying service fails At the moment we treat a failure in any service as a signal to stop tracking users responses to service questions. This commit makes sure we don't stop waiting for answers if a background service fails. Part-of: --- js/gdm/authPrompt.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index de777450e7..0b3da4ecb2 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -321,8 +321,11 @@ var AuthPrompt = GObject.registerClass({ _onVerificationFailed(userVerifier, serviceName, canRetry) { const wasQueryingService = this._queryingService === serviceName; - this._queryingService = null; - this.clear(); + + if (wasQueryingService) { + this._queryingService = null; + this.clear(); + } this.updateSensitivity(canRetry); this.setActorInDefaultButtonWell(null); -- GitLab From a97c4b89458f7b0734f10428692f7337490a6026 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 28 Apr 2021 10:38:58 -0400 Subject: [PATCH 2/5] authPrompt: Don't fail auth prompt until user is out of retries At the moment we set the state of the auth prompt to failed any time the user fails an attempt. But verification is still going on until the user exhausts all attempts, so that's wrong. This commit changes it to only set the state to failed when the user is out of tries. Part-of: --- js/gdm/authPrompt.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 0b3da4ecb2..4844b9ee0c 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -329,7 +329,9 @@ var AuthPrompt = GObject.registerClass({ this.updateSensitivity(canRetry); this.setActorInDefaultButtonWell(null); - this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED; + + if (!canRetry) + this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED; if (wasQueryingService) Util.wiggle(this._entry); -- GitLab From 8cfd4c969ba5e8126234585b1656d905266299dd Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 28 Apr 2021 10:42:14 -0400 Subject: [PATCH 3/5] gdm: Flip canRetry boolean to doneTrying on verification failure This commit flips a boolean in the verification failed handler to make things easier to read. It also moves the retry logic to the bottom where it makes more logical sense. Part-of: --- js/gdm/util.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/js/gdm/util.js b/js/gdm/util.js index 1ee84acde2..cb70c285f5 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -685,29 +685,18 @@ var ShellUserVerifier = class { (this._reauthOnly || this._failCounter < this.allowedFailures); } - _verificationFailed(serviceName, retry) { + _verificationFailed(serviceName, shouldRetry) { // For Not Listed / enterprise logins, immediately reset // the dialog // Otherwise, when in login mode we allow ALLOWED_FAILURES attempts. // After that, we go back to the welcome screen. - - const canRetry = retry && this._canRetry(); - this._disconnectSignals(); + this._filterServiceMessages(serviceName, MessageType.ERROR); - if (canRetry) { - if (!this.hasPendingMessages) { - this._retry(serviceName); - } else { - const cancellable = this._cancellable; - let signalId = this.connect('no-more-messages', () => { - this.disconnect(signalId); - if (!cancellable.is_cancelled()) - this._retry(serviceName); - }); - } - } else { + const doneTrying = !shouldRetry || !this._canRetry(); + + if (doneTrying) { // eslint-disable-next-line no-lonely-if if (!this.hasPendingMessages) { this._cancelAndReset(); @@ -721,7 +710,18 @@ var ShellUserVerifier = class { } } - this.emit('verification-failed', serviceName, canRetry); + this.emit('verification-failed', serviceName, !doneTrying); + + if (!this.hasPendingMessages) { + this._retry(serviceName); + } else { + const cancellable = this._cancellable; + let signalId = this.connect('no-more-messages', () => { + this.disconnect(signalId); + if (!cancellable.is_cancelled()) + this._retry(serviceName); + }); + } } _onServiceUnavailable(_client, serviceName, errorMessage) { -- GitLab From 588dd6d80a844c4130b6f30ff8c5816b3b2a1f4f Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 28 Apr 2021 10:44:56 -0400 Subject: [PATCH 4/5] gdm: Only disconnect verification signals when not going to retry At the moment a failure in a background service can lead to the various verification signals getting disconnected, even though we still need them for a foreground service. This commit changes the code to only disconnect when we've run out of tries. Part-of: --- js/gdm/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/gdm/util.js b/js/gdm/util.js index cb70c285f5..ecaf09b6a8 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -690,13 +690,13 @@ var ShellUserVerifier = class { // the dialog // Otherwise, when in login mode we allow ALLOWED_FAILURES attempts. // After that, we go back to the welcome screen. - this._disconnectSignals(); - this._filterServiceMessages(serviceName, MessageType.ERROR); const doneTrying = !shouldRetry || !this._canRetry(); if (doneTrying) { + this._disconnectSignals(); + // eslint-disable-next-line no-lonely-if if (!this.hasPendingMessages) { this._cancelAndReset(); -- GitLab From 724291de7f9fc89662fb7a0c71f4226a62eb2359 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 28 Apr 2021 18:32:22 +0200 Subject: [PATCH 5/5] gdm: Remove pending fingerprint verification failure It can happen that we get a problem report and a verification failure at the same time. For fingerprint, a problem report can result in an internal verification failure to be queued. Remove this queued failure again if we got a failure already from GDM directly. Part-of: --- js/gdm/util.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/gdm/util.js b/js/gdm/util.js index ecaf09b6a8..72561daab2 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -686,6 +686,11 @@ var ShellUserVerifier = class { } _verificationFailed(serviceName, shouldRetry) { + if (serviceName === FINGERPRINT_SERVICE_NAME) { + if (this._fingerprintFailedId) + GLib.source_remove(this._fingerprintFailedId); + } + // For Not Listed / enterprise logins, immediately reset // the dialog // Otherwise, when in login mode we allow ALLOWED_FAILURES attempts. -- GitLab