Bug 327812 - Add server name validation for POP3/IMAP/News/LDAP server in the account manager. r=IanN, r=mkmelin
authoraceman <acelists@atlas.sk>
Sun, 02 Dec 2012 15:28:46 -0500
changeset 11654 4db7af212d1354133ce28e86f6d91f59818e0ce5
parent 11653 0d15ba91f5a99a872838dce8214ea1e80e984292
child 11655 ed3c904b2d9069eaee11912c9347e041e2b44f68
push id8685
push userryanvm@gmail.com
push dateSun, 02 Dec 2012 20:28:45 +0000
treeherdercomm-central@4db7af212d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, mkmelin
bugs327812
Bug 327812 - Add server name validation for POP3/IMAP/News/LDAP server in the account manager. r=IanN, r=mkmelin
mail/locales/en-US/chrome/messenger/prefs.properties
mailnews/addrbook/prefs/content/pref-directory-add.js
mailnews/base/prefs/content/AccountManager.js
mailnews/base/prefs/content/AccountManager.xul
mailnews/base/prefs/content/AccountWizard.xul
mailnews/base/prefs/content/SmtpServerEdit.js
mailnews/base/prefs/content/SmtpServerEdit.xul
mailnews/base/prefs/content/accountcreation/emailWizard.js
mailnews/base/prefs/content/accountcreation/sanitizeDatatypes.js
mailnews/base/prefs/content/amUtils.js
mailnews/base/prefs/content/aw-incoming.js
mailnews/base/prefs/content/aw-outgoing.js
mailnews/base/prefs/content/smtpEditOverlay.js
mailnews/base/util/hostnameUtils.jsm
suite/locales/en-US/chrome/mailnews/pref/prefs.properties
--- a/mail/locales/en-US/chrome/messenger/prefs.properties
+++ b/mail/locales/en-US/chrome/messenger/prefs.properties
@@ -9,17 +9,17 @@ accountExists=A mail or newsgroup accoun
 modifiedAccountExists=An account with that user name and server name already exists. Please enter a different user name and/or server name.
 userNameChanged=Your User Name has been updated. You may also need to update your Email Address and/or User Name associated with this account.
 serverNameChanged=The server name setting has changed. Please verify that any folders used by filters exist on the new server.
 # LOCALIZATION NOTE (junkSettingsBroken): %1$S is the account name
 junkSettingsBroken=The Junk settings on account "%1$S" have a possible problem. Would you like to review them before saving Account Settings?
 # LOCALIZATION NOTE (localDirectoryChanged): %1$S is program name (&brandShortName;)
 localDirectoryChanged=%1$S needs to restart now to apply the change to the Local directory setting.
 localDirectoryRestart=Restart
-serverNameEmpty=Neither the server name nor the user name can be empty.
+userNameEmpty=The user name can not be empty.
 localDirectoryInvalid=The directory specified in the Local Directory setting is invalid. Please pick a different directory.
 # if the user chooses to cancel the wizard when no accounts are there throw a message
 # LOCALIZATION NOTE (cancelWizard)
 # do not localize "\n\n"
 cancelWizard=Are you sure you want to exit the Account Wizard?\n\nIf you exit, any information you have entered will be lost and the account will not be created.
 accountWizard=Account Wizard
 WizardExit=Exit
 WizardContinue=Cancel
--- a/mailnews/addrbook/prefs/content/pref-directory-add.js
+++ b/mailnews/addrbook/prefs/content/pref-directory-add.js
@@ -1,16 +1,17 @@
 /* -*- Mode: Java; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource:///modules/mailServices.js");
+Components.utils.import("resource:///modules/hostnameUtils.jsm");
 
 var gCurrentDirectory = null;
 var gReplicationBundle = null;
 var gReplicationService =
   Components.classes["@mozilla.org/addressbook/ldap-replication-service;1"].
              getService(Components.interfaces.nsIAbLDAPReplicationService);
 var gReplicationCancelled = false;
 var gProgressText;
@@ -292,25 +293,25 @@ function hasCharacters(number)
 
 function onAccept()
 {
   try {
     var pref_string_content = "";
     var pref_string_title = "";
 
     var description = document.getElementById("description").value;
-    var hostname = document.getElementById("hostname").value;
+    var hostname = cleanUpHostName(document.getElementById("hostname").value);
     var port = document.getElementById("port").value;
     var secure = document.getElementById("secure");
     var results = document.getElementById("results").value;
     var errorValue = null;
     var saslMechanism = "";
     if ((!description) || hasOnlyWhitespaces(description))
       errorValue = "invalidName";
-    else if ((!hostname) || hasOnlyWhitespaces(hostname))
+    else if (!isLegalHostNameOrIP(hostname))
       errorValue = "invalidHostname";
     // XXX write isValidDn and call it on the dn string here?
     else if (port && hasCharacters(port))
       errorValue = "invalidPortNumber";
     else if (results && hasCharacters(results))
       errorValue = "invalidResults";
     if (!errorValue) {
       // XXX Due to the LDAP c-sdk pass a dummy url to the IO service, then
--- a/mailnews/base/prefs/content/AccountManager.js
+++ b/mailnews/base/prefs/content/AccountManager.js
@@ -24,16 +24,17 @@
  *   it is called. The onInit method can further update this page based
  *   on values set in the previous step.
  */
 
 Components.utils.import("resource:///modules/iteratorUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource:///modules/mailServices.js");
 Components.utils.import("resource:///modules/folderUtils.jsm");
+Components.utils.import("resource:///modules/hostnameUtils.jsm");
 
 // If Local directory has changed the app needs to restart. Once this is set
 // a restart will be attempted at each attempt to close the Account manager with OK.
 var gRestartNeeded = false;
 
 // This is a hash-map for every account we've touched in the pane. Each entry
 // has additional maps of attribute-value pairs that we're going to want to save
 // when the user hits OK.
@@ -371,24 +372,36 @@ function checkUserServerChanges(showAler
   // There is no username defined for news so reset it.
   if (newType == "nntp") {
     oldUser = newUser = "";
     checkUser = false;
   }
   alertText = null;
   // If something is changed then check if the new user/host already exists.
   if ((oldUser != newUser) || (oldHost != newHost)) {
-    if ((checkUser && (newUser == "")) || (newHost == "")) {
-        alertText = prefBundle.getString("serverNameEmpty");
-    } else {
+    newUser = newUser.trim();
+    newHost = cleanUpHostName(newHost);
+    if (checkUser && (newUser == "")) {
+      alertText = prefBundle.getString("userNameEmpty");
+    }
+    else if (!isLegalHostNameOrIP(newHost)) {
+      alertText = prefBundle.getString("enterValidServerName");
+    }
+    else {
       let sameServer = MailServices.accounts
-                                   .findRealServer(newUser, newHost, newType, 0)
-      if (sameServer && (sameServer != currentAccount.incomingServer))
+                                   .findRealServer(newUser, newHost, newType, 0);
+      if (sameServer && (sameServer != currentAccount.incomingServer)) {
         alertText = prefBundle.getString("modifiedAccountExists");
+      } else {
+        // New hostname passed all checks. We may have cleaned it up so set
+        // the new value back into the input element.
+        setFormElementValue(pageElements[hIndx], newHost);
+      }
     }
+
     if (alertText) {
       if (showAlert)
         Services.prompt.alert(window, alertTitle, alertText);
       // Restore the old values before return
       if (checkUser)
         setFormElementValue(pageElements[uIndx], oldUser);
       setFormElementValue(pageElements[hIndx], oldHost);
       // If no message is shown to the user, silently revert the values
--- a/mailnews/base/prefs/content/AccountManager.xul
+++ b/mailnews/base/prefs/content/AccountManager.xul
@@ -14,17 +14,16 @@
         style="&accountManager.size;"
         persist="screenX screenY"
         buttons="accept,cancel"
         onload="onLoad(event);"
         onunload="onUnload();"
         ondialogaccept="return onAccept(true);">
 <stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
 <stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
-<script type="application/javascript" src="chrome://messenger/content/amUtils.js"/>
 <script type="application/javascript" src="chrome://messenger/content/accountUtils.js"/>
 <script type="application/javascript" src="chrome://messenger/content/am-prefs.js"/>
 <script type="application/javascript" src="chrome://messenger/content/AccountManager.js"/>
 <script type="application/javascript" src="chrome://messenger/content/am-help.js"/>
 
   <hbox flex="1">
     <vbox style="&accountTree.width;">
       <tree flex="1" onselect="onAccountTreeSelect(null, null);" id="accounttree"
--- a/mailnews/base/prefs/content/AccountWizard.xul
+++ b/mailnews/base/prefs/content/AccountWizard.xul
@@ -12,17 +12,16 @@
         onwizardfinish="return FinishAccount();"
         onload="onAccountWizardLoad();"
         style="&accountWizard.size;"
         xmlns:nc="http://home.netscape.com/NC-rdf#"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
-  <script type="application/javascript" src="chrome://messenger/content/amUtils.js"/>
   <script type="application/javascript" src="chrome://messenger/content/accountUtils.js"/>
   <script type="application/javascript" src="chrome://messenger/content/AccountWizard.js"/>
   <script type="application/javascript" src="chrome://messenger/content/ispUtils.js"/>
   <script type="application/javascript" src="chrome://messenger/content/aw-accounttype.js"/>
   <script type="application/javascript" src="chrome://messenger/content/aw-identity.js"/>
   <script type="application/javascript" src="chrome://messenger/content/aw-incoming.js"/>
   <script type="application/javascript" src="chrome://messenger/content/aw-outgoing.js"/>
   <script type="application/javascript" src="chrome://messenger/content/aw-accname.js"/>
--- a/mailnews/base/prefs/content/SmtpServerEdit.js
+++ b/mailnews/base/prefs/content/SmtpServerEdit.js
@@ -12,17 +12,17 @@ let gSmtpServer;
 function onLoad(event)
 {
   gSmtpServer = window.arguments[0].server;
   initSmtpSettings(gSmtpServer);
 }
 
 function onAccept()
 {
-  if (!isLegalHostNameOrIP(cleanUpHostname(gSmtpHostname.value))) {
+  if (!isLegalHostNameOrIP(cleanUpHostName(gSmtpHostname.value))) {
     let prefsBundle = document.getElementById("bundle_prefs");
     let brandBundle = document.getElementById("bundle_brand");
     let alertTitle = brandBundle.getString("brandShortName");
     let alertMsg = prefsBundle.getString("enterValidServerName");
     Services.prompt.alert(window, alertTitle, alertMsg);
 
     window.arguments[0].result = false;
     return false;
--- a/mailnews/base/prefs/content/SmtpServerEdit.xul
+++ b/mailnews/base/prefs/content/SmtpServerEdit.xul
@@ -18,13 +18,11 @@
         ondialogaccept="return onAccept();">
   <stringbundle id="bundle_prefs"
                 src="chrome://messenger/locale/prefs.properties"/>
   <stringbundle id="bundle_brand"
                 src="chrome://branding/locale/brand.properties"/>
   <stringbundle id="bundle_messenger"
                 src="chrome://messenger/locale/messenger.properties"/>
   <script type="application/javascript"
-          src="chrome://messenger/content/amUtils.js"/>
-  <script type="application/javascript"
           src="chrome://messenger/content/SmtpServerEdit.js"/>
   <vbox id="smtpServerEditor"/>
 </dialog>
--- a/mailnews/base/prefs/content/accountcreation/emailWizard.js
+++ b/mailnews/base/prefs/content/accountcreation/emailWizard.js
@@ -26,17 +26,16 @@ Components.utils.import("resource://gre/
  * - verify the setup, by trying to login to the configured servers
  * - let user verify and maybe edit the server names and ports
  * - If user clicks OK, create the account
  */
 
 
 // from http://xyfer.blogspot.com/2005/01/javascript-regexp-email-validator.html
 var emailRE = /^[-_a-z0-9\'+*$^&%=~!?{}]+(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*@(?:[-a-z0-9.]+\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d+)?$/i;
-var domainRE = /^((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$|(\[?(\d{1,3}\.){3}\d{1,3}\]?)$/i
 const kHighestPort = 65535;
 
 Cu.import("resource:///modules/gloda/log4moz.js");
 let gEmailWizardLogger = Log4Moz.getConfiguredLogger("mail.wizard");
 
 var gStringsBundle;
 var gMessengerBundle;
 var gBrandShortName;
--- a/mailnews/base/prefs/content/accountcreation/sanitizeDatatypes.js
+++ b/mailnews/base/prefs/content/accountcreation/sanitizeDatatypes.js
@@ -11,16 +11,18 @@
  * input variables (strings, if nothing else is noted) are of the expected
  * type and syntax.
  *
  * The functions take a string (unless noted otherwise) and return
  * the expected datatype in JS types. If the value is not as expected,
  * they throw exceptions.
  */
 
+Components.utils.import("resource:///modules/hostnameUtils.jsm");
+
 var sanitize =
 {
   integer : function(unchecked)
   {
     if (typeof(unchecked) == "number" && !isNaN(unchecked))
       return unchecked;
 
     var r = parseInt(unchecked);
@@ -86,26 +88,26 @@ var sanitize =
   /**
    * DNS hostnames like foo.bar.example.com
    * Allow only letters, numbers, "-" and "."
    * Empty strings not allowed.
    * Currently does not support IDN (international domain names).
    */
   hostname : function(unchecked)
   {
-    var str = this.nonemptystring(unchecked);
+    let str = cleanUpHostName(this.nonemptystring(unchecked));
 
     // Allow placeholders. TODO move to a new hostnameOrPlaceholder()
     // The regex is "anything, followed by one or more (placeholders than
     // anything)".  This doesn't catch the non-placeholder case, but that's
     // handled down below.
     if (/^[a-zA-Z0-9\-\.]*(%[A-Z0-9]+%[a-zA-Z0-9\-\.]*)+$/.test(str))
       return str;
 
-    if (!/^[a-zA-Z0-9\-\.]*$/.test(str))
+    if (!isLegalHostNameOrIP(str))
       throw new MalformedException("hostname_syntax.error", unchecked);
 
     return str.toLowerCase();
   },
   /**
    * A non-chrome URL that's safe to request.
    */
   url : function (unchecked)
--- a/mailnews/base/prefs/content/amUtils.js
+++ b/mailnews/base/prefs/content/amUtils.js
@@ -1,14 +1,13 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-Components.utils.import("resource:///modules/hostnameUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 Components.utils.import("resource:///modules/mailServices.js");
 
 function BrowseForLocalFolders()
 {
   const nsIFilePicker = Components.interfaces.nsIFilePicker;
   const nsILocalFile = Components.interfaces.nsILocalFile;
 
@@ -125,20 +124,8 @@ function openPrefsFromAccountManager(aTB
 
   // If openOptionsDialog() exists, we are in Thunderbird.
   if (typeof win.openOptionsDialog == "function")
     win.openOptionsDialog(aTBPaneId, aTBTabId, aTBOtherArgs);
   // If goPreferences() exists, we are in Seamonkey.
   if (typeof win.goPreferences == "function")
     win.goPreferences(aSMPaneId);
 }
-
-/**
- * Clean up the hostname or IP.
- *
- * @param aHostName  The hostname or IP string to clean up.
- */
-function cleanUpHostname(aHostName)
-{
-  // TODO: Bug 235312: if UTF8 string was input, convert to punycode using convertUTF8toACE()
-  // but bug 563172 needs resolving first.
-  return aHostName.trim();
-}
--- a/mailnews/base/prefs/content/aw-incoming.js
+++ b/mailnews/base/prefs/content/aw-incoming.js
@@ -12,22 +12,22 @@ var gProtocolInfo = null;
 
 function incomingPageValidate()
 {
   var canAdvance = true;
   var hostName;
 
   if (gOnMailServersPage) {
     hostName = document.getElementById("incomingServer").value;
-    if (!gHideIncoming && !isLegalHostNameOrIP(cleanUpHostname(hostName)))
+    if (!gHideIncoming && !isLegalHostNameOrIP(cleanUpHostName(hostName)))
       canAdvance = false;
   }
   if (gOnNewsServerPage) {
     hostName = document.getElementById("newsServer").value;
-    if (!isLegalHostNameOrIP(cleanUpHostname(hostName)))
+    if (!isLegalHostNameOrIP(cleanUpHostName(hostName)))
       canAdvance = false;
   }
 
   if (canAdvance) {
     var pageData = parent.GetPageData();
     var serverType = parent.getCurrentServerType(pageData);
     var username = document.getElementById("username").value;
     if (gProtocolInfo && gProtocolInfo.requiresUsername && !username ||
@@ -42,26 +42,26 @@ function incomingPageUnload()
 {
   var pageData = parent.GetPageData();
 
   if (gOnMailServersPage) {
     // If we have hidden the incoming server dialogs, we don't want
     // to set the server to an empty value here
     if (!gHideIncoming) {
       var incomingServerName = document.getElementById("incomingServer");
-      setPageData(pageData, "server", "hostname", cleanUpHostname(incomingServerName.value));
+      setPageData(pageData, "server", "hostname", cleanUpHostName(incomingServerName.value));
     }
     var serverport = document.getElementById("serverPort").value;
     setPageData(pageData, "server", "port", serverport);
     var username = document.getElementById("username").value;
     setPageData(pageData, "login", "username", username);
   }
   else if (gOnNewsServerPage) {
     var newsServerName = document.getElementById("newsServer");
-    setPageData(pageData, "newsserver", "hostname", cleanUpHostname(newsServerName.value));
+    setPageData(pageData, "newsserver", "hostname", cleanUpHostName(newsServerName.value));
   }
 
   return true;
 }
 
 function incomingPageInit() {
   gOnMailServersPage = (document.documentElement.currentPage.id == "incomingpage");
   gOnNewsServerPage = (document.documentElement.currentPage.id == "newsserver");
--- a/mailnews/base/prefs/content/aw-outgoing.js
+++ b/mailnews/base/prefs/content/aw-outgoing.js
@@ -8,27 +8,27 @@ Components.utils.import("resource:///mod
 var gProtocolInfo = null;
 var gPrefsBundle;
 
 function outgoingPageValidate() {
   let canAdvance = true;
 
   let smtpServer = document.getElementById("smtphostname").value;
   let usingDefaultSMTP = document.getElementById("noSmtp").hidden;
-  if (!usingDefaultSMTP && !isLegalHostNameOrIP(cleanUpHostname(smtpServer)))
+  if (!usingDefaultSMTP && !isLegalHostNameOrIP(cleanUpHostName(smtpServer)))
     canAdvance = false;
 
   document.documentElement.canAdvance = canAdvance;
 }
 
 function outgoingPageUnload() {
   var pageData = parent.GetPageData();
   var username = document.getElementById("username").value;
   let smtpserver = document.getElementById("smtphostname").value;
-  setPageData(pageData, "server", "smtphostname", cleanUpHostname(smtpserver));
+  setPageData(pageData, "server", "smtphostname", cleanUpHostName(smtpserver));
 
   // If SMTP username box is blank it is because the
   // incoming and outgoing server names were the same,
   // so set to be same as incoming username
   var smtpusername = document.getElementById("smtpusername").value || username;
 
   setPageData(pageData, "login", "smtpusername", smtpusername);
 
--- a/mailnews/base/prefs/content/smtpEditOverlay.js
+++ b/mailnews/base/prefs/content/smtpEditOverlay.js
@@ -114,17 +114,17 @@ function disableIfLocked(prefstrArray)
     if (smtpPrefBranch.prefIsLocked(prefstring))
       prefstrArray[prefstring].disabled = true;
 }
 
 function saveSmtpSettings(server)
 {
     //dump("Saving to " + server + "\n");
     if (server) {
-        server.hostname = cleanUpHostname(gSmtpHostname.value);
+        server.hostname = cleanUpHostName(gSmtpHostname.value);
         server.description = gSmtpDescription.value;
         server.port = gSmtpPort.value;
         server.authMethod = gSmtpAuthMethod.value;
         server.username = gSmtpUsername.value;
         server.socketType = gSmtpSocketType.value;
     }
 }
 
--- a/mailnews/base/util/hostnameUtils.jsm
+++ b/mailnews/base/util/hostnameUtils.jsm
@@ -1,24 +1,24 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
- * Generic shared utility code for checking of IP and hostname
- * validity.
+ * Generic shared utility code for checking of IP and hostname validity.
  */
 
 const EXPORTED_SYMBOLS = [ "isLegalHostNameOrIP",
                            "isLegalHostName",
                            "isLegalIPv4Address",
                            "isLegalIPv6Address",
                            "isLegalIPAddress",
-                           "isLegalLocalIPAddress" ];
+                           "isLegalLocalIPAddress",
+                           "cleanUpHostName" ];
 
 /**
  * Check if aHostName is an IP address or a valid hostname.
  *
  * @param aHostName                The string to check for validity.
  * @param aAllowExtendedIPFormats  Allow hex/octal formats in addition to decimal.
  * @return  Unobscured host name if aHostName is valid.
  *          Returns null if it's not.
@@ -83,16 +83,19 @@ function isLegalHostName(aHostName)
  *          Returns null if it's not.
  */
 function isLegalIPv4Address(aHostName, aAllowExtendedIPFormats)
 {
   // Scammers frequently obscure the IP address by encoding each component as
   // octal, hex or in some cases a mix match of each. The IP address could
   // also be represented as a DWORD.
 
+  if (!aHostName)
+    return null;
+
   // Break the IP address down into individual components.
   let ipComponents = aHostName.split(".");
 
   if (ipComponents.length == 4)
   {
     for (let i = 0; i < ipComponents.length; i++)
     {
       // is the component decimal?
@@ -149,16 +152,19 @@ function isLegalIPv4Address(aHostName, a
  * Check if aHostName is an IPv6 address.
  *
  * @param aHostName  The string to check for validity.
  * @return  Unobscured canonicalized address if aHostName is an IPv6 address.
  *          Returns null if it's not.
  */
 function isLegalIPv6Address(aHostName)
 {
+  if (!aHostName)
+    return null;
+
   // Break the IP address down into individual components.
   let ipComponents = aHostName.toLowerCase().split(":");
 
   // Make sure there are at least 3 components.
   if (ipComponents.length < 3)
     return null;
 
   let ipLength = ipComponents.length - 1;
@@ -285,8 +291,21 @@ function isLegalLocalIPAddress(aIPAddres
     if (ipComponents[0].substr(0,2) == "fc" || // usage has not been defined yet
         ipComponents[0].substr(0,2) == "fd")
       return true;
 
     return false;
   }
   return false;
 }
+
+/**
+ * Clean up the hostname or IP. Usually used to sanitize a value input by the user.
+ * It is usually applied before we know if the hostname is even valid.
+ *
+ * @param aHostName  The hostname or IP string to clean up.
+ */
+function cleanUpHostName(aHostName)
+{
+  // TODO: Bug 235312: if UTF8 string was input, convert to punycode using convertUTF8toACE()
+  // but bug 563172 needs resolving first.
+  return aHostName.trim();
+}
--- a/suite/locales/en-US/chrome/mailnews/pref/prefs.properties
+++ b/suite/locales/en-US/chrome/mailnews/pref/prefs.properties
@@ -10,17 +10,17 @@ accountExists=A mail or newsgroup accoun
 modifiedAccountExists=An account with that user name and server name already exists. Please enter a different user name and/or server name.
 userNameChanged=Your User Name has been updated. You may also need to update your Email Address and/or User Name associated with this account.
 serverNameChanged=The server name setting has changed. Please verify that any folders used by filters exist on the new server.
 # LOCALIZATION NOTE (junkSettingsBroken): %1$S is the account name
 junkSettingsBroken=The Junk settings on account "%1$S" have a possible problem. Would you like to review them before saving Account Settings?
 # LOCALIZATION NOTE (localDirectoryChanged): %1$S is program name (&brandShortName;)
 localDirectoryChanged=%1$S needs to restart now to apply the change to the Local directory setting.
 localDirectoryRestart=Restart
-serverNameEmpty=Neither the server name nor the user name can be empty.
+userNameEmpty=The user name can not be empty.
 localDirectoryInvalid=The directory specified in the Local Directory setting is invalid. Please pick a different directory.
 # if the user chooses to cancel the wizard when no accounts are there throw a message
 # LOCALIZATION NOTE (cancelWizard)
 # do not localize "\n\n"
 cancelWizard=Are you sure you want to exit the Account Wizard?\n\nIf you exit, any information you have entered will be lost and the account will not be created.
 accountWizard=Account Wizard
 WizardExit=Exit
 WizardContinue=Cancel