Commit 66bd9dc5 authored by anonym's avatar anonym

Thunderbird: patch to fix buggy MS Exchange autoconfig pref.

When MS Exchange autoconfig is disabled via this pref, the account
wizard breaks, making it useless. It seems the work in refs: #6156
did this. The added patch fixes this, and should be upstreamed.

Will-fix: #17654
parent fc101b0a
From a95fe8ff521840faffecc89d9ae7a51fccc1ba82 Mon Sep 17 00:00:00 2001
From: anonym <anonym@riseup.net>
Date: Fri, 24 Apr 2020 16:01:39 +0200
Subject: [PATCH] Fix buggy pref for disabling MS Exchange autoconfig method.
Before the upstream work that made the autoconfig methods happen in
parallel this was working, but when I adapted it to that work I seem
to have made a mistake or misunderstood something. In fact, the error
propagation now happens in a way that makes it very unsuitable to have
this check this deep down in the call stack. The check should happen
earlier.
So let's just not initiate this autoconfig method at all when
disabled, with the added benefit of it not showing up as an
immediately failed method in the list of attempts. This makes so much
more sense!
While we're at it, let's do the same for when the MX method is
disabled since there is no reason for it to be listed as a failure
when disabled either.
---
.../accountcreation/content/emailWizard.js | 81 ++++++++++---------
.../content/exchangeAutoDiscover.js | 10 ---
2 files changed, 45 insertions(+), 46 deletions(-)
diff --git a/comm/mail/components/accountcreation/content/emailWizard.js b/comm/mail/components/accountcreation/content/emailWizard.js
index 3780792641a..0b53b0a498d 100644
--- a/comm/mail/components/accountcreation/content/emailWizard.js
+++ b/comm/mail/components/accountcreation/content/emailWizard.js
@@ -677,44 +677,53 @@ EmailConfigWizard.prototype = {
);
call.setAbortable(fetch);
- call = priority.addCall();
- this.addStatusLine("looking_up_settings_mx", call);
- // "found_settings_db" is correct. We display the same message for both db and mx cases.
- call.foundMsg = "found_settings_db";
- fetch = fetchConfigForMX(
- domain,
- call.successCallback(),
- call.errorCallback()
- );
- call.setAbortable(fetch);
+ if (Services.prefs.getCharPref("mailnews.mx_service_url") != "") {
+ call = priority.addCall();
+ this.addStatusLine("looking_up_settings_mx", call);
+ // "found_settings_db" is correct. We display the same message for both db and mx cases.
+ call.foundMsg = "found_settings_db";
+ fetch = fetchConfigForMX(
+ domain,
+ call.successCallback(),
+ call.errorCallback()
+ );
+ call.setAbortable(fetch);
+ }
- call = priority.addCall();
- this.addStatusLine("looking_up_settings_exchange", call);
- call.foundMsg = "found_settings_exchange";
- fetch = fetchConfigFromExchange(
- domain,
- emailAddress,
- this._exchangeUsername,
- this._password,
- call.successCallback(),
- (e, allErrors) => {
- // Must call error callback in any case to stop the discover mode.
- let errorCallback = call.errorCallback();
- if (allErrors && allErrors.some(e => e.code == 401)) {
- // Auth failed.
- // Ask user for username.
- this.onStartOver();
- this.stopSpinner(); // clears status message
- _show("usernameRow");
- _show("status_area");
- _enable("manual-edit_button");
- errorCallback(new CancelledException());
- } else {
- errorCallback(e);
+ if (
+ Services.prefs.getBoolPref(
+ "mailnews.auto_config.fetchFromExchange.enabled",
+ true
+ )
+ ) {
+ call = priority.addCall();
+ this.addStatusLine("looking_up_settings_exchange", call);
+ call.foundMsg = "found_settings_exchange";
+ fetch = fetchConfigFromExchange(
+ domain,
+ emailAddress,
+ this._exchangeUsername,
+ this._password,
+ call.successCallback(),
+ (e, allErrors) => {
+ // Must call error callback in any case to stop the discover mode.
+ let errorCallback = call.errorCallback();
+ if (allErrors && allErrors.some(e => e.code == 401)) {
+ // Auth failed.
+ // Ask user for username.
+ this.onStartOver();
+ this.stopSpinner(); // clears status message
+ _show("usernameRow");
+ _show("status_area");
+ _enable("manual-edit_button");
+ errorCallback(new CancelledException());
+ } else {
+ errorCallback(e);
+ }
}
- }
- );
- call.setAbortable(fetch);
+ );
+ call.setAbortable(fetch);
+ }
} catch (e) {
// e.g. when entering an invalid domain like "c@c.-com"
this.showErrorMsg(e);
diff --git a/comm/mail/components/accountcreation/content/exchangeAutoDiscover.js b/comm/mail/components/accountcreation/content/exchangeAutoDiscover.js
index f9d2a6e0d3e..efe9966a600 100644
--- a/comm/mail/components/accountcreation/content/exchangeAutoDiscover.js
+++ b/comm/mail/components/accountcreation/content/exchangeAutoDiscover.js
@@ -47,16 +47,6 @@ function fetchConfigFromExchange(
) {
assert(typeof successCallback == "function");
assert(typeof errorCallback == "function");
- if (
- !Services.prefs.getBoolPref(
- "mailnews.auto_config.fetchFromExchange.enabled",
- true
- )
- ) {
- errorCallback("Exchange AutoDiscover disabled per user preference");
- return new Abortable();
- }
-
// <https://technet.microsoft.com/en-us/library/bb124251(v=exchg.160).aspx#Autodiscover%20services%20in%20Outlook>
// <https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-interoperability-guidance/hh352638(v%3Dexchg.140)>, search for "The Autodiscover service uses one of these four methods"
let url1 =
--
2.26.1
......@@ -3,4 +3,5 @@ Make-use-of-non-SSL-Exchange-AutoDiscover-methods-op.patch
Add-pref-for-whether-we-accept-OAuth2-during-autocon.patch
Add-pref-for-whether-to-accept-plaintext-protocols-d.patch
Avoid-local-timestamp-disclosure-in-Date-header.patch
Avoid-spellchecking-language-disclosure-in-Content-Language-header.patch
\ No newline at end of file
Avoid-spellchecking-language-disclosure-in-Content-Language-header.patch
Fix-buggy-pref-for-disabling-MS-Exchange-autoconfig-.patch
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment