[Pkg-privacy-commits] [torbirdy] 31/53: Secure NNTP settings on account creation (#7847)

Ulrike Uhlig u-guest at moszumanska.debian.org
Sat Jul 2 20:08:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to annotated tag 0.2.0
in repository torbirdy.

commit 0f1d01af3ab0572f4ffc25bb67c1b03afc9591f5
Author: Sukhbir Singh <sukhbir at torproject.org>
Date:   Fri May 13 18:26:10 2016 -0400

    Secure NNTP settings on account creation (#7847)
---
 chrome.manifest               |  1 +
 chrome/content/nntpwizard.js  | 90 +++++++++++++++++++++++++++++++++++++++++++
 chrome/content/nntpwizard.xul | 10 +++++
 3 files changed, 101 insertions(+)

diff --git a/chrome.manifest b/chrome.manifest
index 431b4c9..33b0a10 100644
--- a/chrome.manifest
+++ b/chrome.manifest
@@ -4,6 +4,7 @@ overlay chrome://messenger/content/messenger.xul chrome://castironthunderbirdclu
 overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://castironthunderbirdclub/content/composeoverlay.xul
 overlay chrome://messenger/content/accountcreation/emailWizard.xul chrome://castironthunderbirdclub/content/emailwizard.xul
 overlay chrome://messenger-newsblog/content/feedAccountWizard.xul chrome://castironthunderbirdclub/content/feedwizard.xul
+overlay chrome://messenger/content/AccountWizard.xul chrome://castironthunderbirdclub/content/nntpwizard.xul
 
 component {ebd85413-18c8-4265-a708-a8890ec8d1ed} components/torbirdy.js
 contract @torproject.org/torbirdy;1 {ebd85413-18c8-4265-a708-a8890ec8d1ed}
diff --git a/chrome/content/nntpwizard.js b/chrome/content/nntpwizard.js
new file mode 100644
index 0000000..90051bb
--- /dev/null
+++ b/chrome/content/nntpwizard.js
@@ -0,0 +1,90 @@
+Components.utils.import("resource://gre/modules/Preferences.jsm");
+
+if (!org) var org = {};
+if (!org.torbirdy) org.torbirdy = {};
+
+if (!org.torbirdy.nntpwizard) org.torbirdy.nntpwizard = new function() {
+  var pub = {};
+
+  pub.fixNntpPort = function(account) {
+    let key = account.incomingServer.key;
+
+    let pref_spec = [
+      // Set the port to 563 and connection security to SSL/TLS (NNTPS).
+      ['mail.server.%serverkey%.port', 563],
+      ['mail.server.%serverkey%.socketType', 3]
+    ];
+
+    for each (var [pref_template, value] in pref_spec) {
+      let pref = pref_template.replace("%serverkey%", key);
+      Preferences.set(pref, value);
+    }
+  };
+
+  // This is from mailnews/base/prefs/content/AccountWizard.xul : FinishAccount().
+  FinishAccount = function() {
+    try {
+      var pageData = GetPageData();
+
+      var accountData= gCurrentAccountData;
+
+      if (!accountData)
+      {
+        accountData = new Object;
+        // Time to set the smtpRequiresUsername attribute
+        if (!serverIsNntp(pageData))
+          accountData.smtpRequiresUsername = true;
+      }
+
+      // we may need local folders before account is "Finished"
+      // if it's a pop3 account which defers to Local Folders.
+      verifyLocalFoldersAccount();
+
+      PageDataToAccountData(pageData, accountData);
+
+      FixupAccountDataForIsp(accountData);
+
+      // we might be simply finishing another account
+      if (!gCurrentAccount)
+        gCurrentAccount = createAccount(accountData);
+
+      // transfer all attributes from the accountdata
+      finishAccount(gCurrentAccount, accountData);
+
+      setupCopiesAndFoldersServer(gCurrentAccount, getCurrentServerIsDeferred(pageData), accountData);
+
+      if (gCurrentAccount.incomingServer.canBeDefaultServer)
+        EnableCheckMailAtStartUpIfNeeded(gCurrentAccount);
+
+      if (!document.getElementById("downloadMsgs").hidden) {
+        // skip the default biff, we will load messages manually if needed
+        window.opener.gLoadStartFolder = false;
+        if (document.getElementById("downloadMsgs").checked) {
+          window.opener.gNewAccountToLoad = gCurrentAccount; // load messages for new POP account
+        }
+      }
+
+      pub.fixNntpPort(gCurrentAccount);
+
+      // in case we crash, force us a save of the prefs file NOW
+      try {
+        MailServices.accounts.saveAccountInfo();
+      }
+      catch (ex) {
+        dump("Error saving account info: " + ex + "\n");
+      }
+      window.close();
+      if(top.okCallback)
+      {
+        var state = true;
+        //dump("finish callback");
+        top.okCallback(state);
+      }
+    }
+    catch(ex) {
+      dump("FinishAccount failed, " + ex +"\n");
+    }
+  };
+
+  return pub;
+};
diff --git a/chrome/content/nntpwizard.xul b/chrome/content/nntpwizard.xul
new file mode 100644
index 0000000..c9ccea1
--- /dev/null
+++ b/chrome/content/nntpwizard.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<?xml-stylesheet href="chrome://messenger/skin/accountWizard.css" type="text/css"?>
+
+<wizard id="castironthunderbirdclub-nntpwizard-overlay"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <script type="application/javascript" src="chrome://castironthunderbirdclub/content/nntpwizard.js" />
+
+</wizard>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbirdy.git



More information about the Pkg-privacy-commits mailing list