[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torbirdy/develop] Set secure defaults for outgoing servers (#19330)
commit 3fef66ce5e06830ead85d4c955908e0f6dc8c56d
Author: Sukhbir Singh <sukhbir@xxxxxxxxxxxxxx>
Date: Tue Jun 7 12:19:27 2016 -0400
Set secure defaults for outgoing servers (#19330)
---
components/torbirdy.js | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/components/torbirdy.js b/components/torbirdy.js
index fa1aa6b..1c71bf0 100644
--- a/components/torbirdy.js
+++ b/components/torbirdy.js
@@ -3,6 +3,7 @@ var { interfaces: Ci, utils: Cu, classes: Cc } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/imXPCOMUtils.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
+Cu.import("resource://gre/modules/Preferences.jsm");
var SERVICE_CTRID = "@torproject.org/torbirdy;1";
var SERVICE_ID = Components.ID("{ebd85413-18c8-4265-a708-a8890ec8d1ed}");
@@ -687,6 +688,30 @@ TorBirdy.prototype = {
// Set the authentication to normal, connection is already encrypted.
account.authMethod = 3;
}
+
+ // We need to set safe defaults for the outgoing servers in case there
+ // are accounts using insecure configurations. One other way way of
+ // accessing the server list can be through nsIMsgIdentity but multiple
+ // identities can share the same server so fetching the preference value
+ // mail.smtpservers seems a better way to do it.
+ let smtpAccounts = this.prefs.getCharPref("mail.smtpservers").split(",");
+ let smtpPrefs = [
+ ["mail.smtpserver.%smtp%.port", 465], // SMTP over TLS
+ ["mail.smtpserver.%smtp%.authMethod", 3], // Normal password
+ ["mail.smtpserver.%smtp%.try_ssl", 3], // SSL/TLS
+ ];
+ for (let i = 0; i < smtpAccounts.length; i++) {
+ for each (var [pref_template, value] in smtpPrefs) {
+ let pref = pref_template.replace("%smtp%", smtpAccounts[i]);
+ if (this.prefs.prefHasUserValue(pref)) {
+ let currentPref = Preferences.get(pref);
+ // Save the values so that we can restore them later.
+ Preferences.set(kRestoreBranch + pref, currentPref);
+ TorBirdyOldPrefs.push(pref);
+ Preferences.set(pref, value);
+ }
+ }
+ }
}
this.prefs.setBoolPref("extensions.torbirdy.first_run", false);
},
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits