Bug 1532388 - Backout the CLIENTID feature (leaving strings in place). a=backout BETA_68_CONTINUATION
authorJorg K <jorgk@jorgk.com>
Thu, 11 Jul 2019 23:06:59 +0200
branchBETA_68_CONTINUATION
changeset 36073 4c7bdd3ba0535e77639e2e874a161f40b63e53d1
parent 36072 bd356636aab529d2137c9a0a2f1c06244962d780
child 36082 09320da375a6a3e5156f1071d978a86d211cab5b
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersbackout
bugs1532388
Bug 1532388 - Backout the CLIENTID feature (leaving strings in place). a=backout
mailnews/base/public/nsIMsgIncomingServer.idl
mailnews/base/util/mailnewsMigrator.js
mailnews/base/util/nsMsgIncomingServer.cpp
mailnews/compose/public/nsISmtpServer.idl
mailnews/compose/src/nsComposeStrings.cpp
mailnews/compose/src/nsComposeStrings.h
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/compose/src/nsSmtpProtocol.h
mailnews/compose/src/nsSmtpServer.cpp
mailnews/imap/src/nsImapCore.h
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapProtocol.h
mailnews/imap/src/nsImapServerResponseParser.cpp
mailnews/mailnews.js
--- a/mailnews/base/public/nsIMsgIncomingServer.idl
+++ b/mailnews/base/public/nsIMsgIncomingServer.idl
@@ -72,22 +72,16 @@ interface nsIMsgIncomingServer : nsISupp
 
   /**
    * protocol type, i.e. "pop3", "imap", "nntp", "none", etc
    * used to construct URLs
    */
   attribute ACString type;
 
   /**
-   * The CLIENTID to use for this server.
-   * @see https://tools.ietf.org/html/draft-yu-imap-client-id-01
-   */
-  attribute ACString clientid;
-
-  /**
    * The proper instance of nsIMsgProtocolInfo corresponding to this server type.
    */
   readonly attribute nsIMsgProtocolInfo protocolInfo;
 
   readonly attribute AString accountManagerChrome;
 
   /**
    * The schema for the local mail store, such as "mailbox", "imap", or "news"
--- a/mailnews/base/util/mailnewsMigrator.js
+++ b/mailnews/base/util/mailnewsMigrator.js
@@ -17,22 +17,16 @@ var {Services} = ChromeUtils.import("res
 var {MailServices} = ChromeUtils.import("resource:///modules/MailServices.jsm");
 var kServerPrefVersion = 1;
 var kSmtpPrefVersion = 1;
 var kABRemoteContentPrefVersion = 1;
 var kDefaultCharsetsPrefVersion = 1;
 
 function migrateMailnews() {
   try {
-    MigrateProfileClientid();
-  } catch (e) {
-    logException(e);
-  }
-
-  try {
     MigrateServerAuthPref();
   } catch (e) {
     logException(e);
   }
 
   try {
     MigrateABRemoteContentSettings();
   } catch (e) {
@@ -42,32 +36,16 @@ function migrateMailnews() {
   try {
     MigrateDefaultCharsets();
   } catch (e) {
     logException(e);
   }
 }
 
 /**
- * Creates the server specific default 'clientid' prefs.
- */
-function MigrateProfileClientid() {
-  // First generate a uuid without braces.
-  let uuidGen = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
-  let defaultClientid = uuidGen.generateUUID().toString().replace(/[{}]/g, "");
-  // We need to populate our default clientid preferences if they are missing.
-  if (!Services.prefs.getCharPref("mail.server.default.clientid")) {
-    Services.prefs.setCharPref("mail.server.default.clientid", defaultClientid);
-  }
-  if (!Services.prefs.getCharPref("mail.smtpserver.default.clientid")) {
-    Services.prefs.setCharPref("mail.smtpserver.default.clientid", defaultClientid);
-  }
-}
-
-/**
  * Migrates from pref useSecAuth to pref authMethod
  */
 function MigrateServerAuthPref() {
   try {
     // comma-separated list of all accounts.
     var accounts = Services.prefs.getCharPref("mail.accountmanager.accounts")
         .split(",");
     for (let i = 0; i < accounts.length; i++) {
--- a/mailnews/base/util/nsMsgIncomingServer.cpp
+++ b/mailnews/base/util/nsMsgIncomingServer.cpp
@@ -1549,17 +1549,16 @@ nsMsgIncomingServer::GetIsSecure(bool *a
   return NS_OK;
 }
 
 // use the convenience macros to implement the accessors
 NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Username, "userName")
 NS_IMPL_SERVERPREF_INT(nsMsgIncomingServer, AuthMethod, "authMethod")
 NS_IMPL_SERVERPREF_INT(nsMsgIncomingServer, BiffMinutes, "check_time")
 NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Type, "type")
-NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Clientid, "clientid")
 NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, DownloadOnBiff, "download_on_biff")
 NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, Valid, "valid")
 NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, EmptyTrashOnExit,
                         "empty_trash_on_exit")
 NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, CanDelete, "canDelete")
 NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, LoginAtStartUp, "login_at_startup")
 NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer,
                         DefaultCopiesAndFoldersPrefsToServer,
--- a/mailnews/compose/public/nsISmtpServer.idl
+++ b/mailnews/compose/public/nsISmtpServer.idl
@@ -31,20 +31,16 @@ interface nsISmtpServer : nsISupports {
   attribute ACString hostname;
 
   /// The server's port.
   attribute int32_t port;
 
   /// The username to access the server with (if required)
   attribute ACString username;
 
-  /// The CLIENTID to use for this server (if required).
-  /// @see https://tools.ietf.org/html/draft-storey-smtp-client-id-05
-  attribute ACString clientid;
-
   /**
    * The password to access the server with (if required).
    *
    * @note this is stored within the server instance but not within preferences.
    * It can be specified/saved here to avoid prompting the user constantly for
    * the sending password.
    */
   attribute AString password;
--- a/mailnews/compose/src/nsComposeStrings.cpp
+++ b/mailnews/compose/src/nsComposeStrings.cpp
@@ -90,19 +90,15 @@ const char* errorStringNameForErrorCode(
     case NS_ERROR_SMTP_AUTH_FAILURE:
       return "smtpAuthFailure";
     case NS_ERROR_SMTP_AUTH_GSSAPI:
       return "smtpAuthGssapi";
     case NS_ERROR_SMTP_AUTH_MECH_NOT_SUPPORTED:
       return "smtpAuthMechNotSupported";
     case NS_ERROR_ILLEGAL_LOCALPART:
       return "errorIllegalLocalPart";
-    case NS_ERROR_CLIENTID:
-      return "smtpClientid";
-    case NS_ERROR_CLIENTID_PERMISSION:
-      return "smtpClientidPermission";
     default:
       return "sendFailed";
   }
 #ifdef __GNUC__
 #  pragma GCC diagnostic pop
 #endif
 }
--- a/mailnews/compose/src/nsComposeStrings.h
+++ b/mailnews/compose/src/nsComposeStrings.h
@@ -62,16 +62,13 @@
 #define NS_ERROR_SMTP_AUTH_CHANGE_ENCRYPT_TO_PLAIN_SSL     NS_MSG_GENERATE_FAILURE(12595)
 #define NS_ERROR_SMTP_AUTH_CHANGE_PLAIN_TO_ENCRYPT         NS_MSG_GENERATE_FAILURE(12596)
 #define NS_ERROR_SMTP_AUTH_FAILURE                  NS_MSG_GENERATE_FAILURE(12597)
 #define NS_ERROR_SMTP_AUTH_GSSAPI                   NS_MSG_GENERATE_FAILURE(12598)
 #define NS_ERROR_SMTP_AUTH_MECH_NOT_SUPPORTED       NS_MSG_GENERATE_FAILURE(12599)
 
 #define NS_ERROR_ILLEGAL_LOCALPART                  NS_MSG_GENERATE_FAILURE(12601)
 
-#define NS_ERROR_CLIENTID                           NS_MSG_GENERATE_FAILURE(12610)
-#define NS_ERROR_CLIENTID_PERMISSION                NS_MSG_GENERATE_FAILURE(12611)
-
 const char* errorStringNameForErrorCode(nsresult aCode);
 
 #endif /* _nsComposeStrings_H__ */
 
 // clang-format on
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -108,18 +108,16 @@ nsresult nsExplainErrorDetails(nsISmtpUr
     case NS_ERROR_SMTP_TEMP_SIZE_EXCEEDED:
     case NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_1:
     case NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_2:
     case NS_ERROR_SENDING_FROM_COMMAND:
     case NS_ERROR_SENDING_RCPT_COMMAND:
     case NS_ERROR_SENDING_DATA_COMMAND:
     case NS_ERROR_SENDING_MESSAGE:
     case NS_ERROR_SMTP_GREETING:
-    case NS_ERROR_CLIENTID:
-    case NS_ERROR_CLIENTID_PERMISSION:
       exitString = errorStringNameForErrorCode(aCode);
       bundle->GetStringFromName(exitString, eMsg);
       if (aCode == NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_1) {
         // Convert the error message argument back to integer since the error
         // message string smtpPermSizeExceeded1 contains a %d.
         // (The special case can be removed if that string ever changes, then
         // %d should be changed to %S.)
         nsTextFormatter::ssprintf(msg, eMsg.get(), atoi(arg1), arg2);
@@ -230,17 +228,16 @@ nsresult nsSmtpProtocol::Initialize(nsIU
 
   m_flags = 0;
   m_prefAuthMethods = 0;
   m_failedAuthMethods = 0;
   m_currentAuthMethod = 0;
   m_usernamePrompted = false;
   m_prefSocketType = nsMsgSocketType::trySTARTTLS;
   m_tlsInitiated = false;
-  m_clientIDInitialized = false;
 
   m_url = aURL;  // Needed in nsMsgAsyncWriteProtocol::UpdateProgress().
   m_urlErrorState = NS_ERROR_FAILURE;
 
   if (aURL) m_runningURL = do_QueryInterface(aURL);
 
   // extract out message feedback if there is any.
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aURL);
@@ -275,17 +272,16 @@ nsresult nsSmtpProtocol::Initialize(nsIU
   // round trip communication between the client and server
   int32_t authMethod = 0;
   nsCOMPtr<nsISmtpServer> smtpServer;
   m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
   if (smtpServer) {
     smtpServer->GetAuthMethod(&authMethod);
     smtpServer->GetSocketType(&m_prefSocketType);
     smtpServer->GetHelloArgument(m_helloArgument);
-    smtpServer->GetClientid(m_clientId);
 
     // Query for OAuth2 support. If the SMTP server preferences don't allow
     // for OAuth2, then don't carry around the OAuth2 module any longer
     // since we won't need it.
     mOAuth2Support = do_CreateInstance(MSGIOAUTH2MODULE_CONTRACTID);
     if (mOAuth2Support) {
       bool supportsOAuth = false;
       mOAuth2Support->InitFromSmtp(smtpServer, &supportsOAuth);
@@ -847,20 +843,16 @@ nsresult nsSmtpProtocol::SendEhloRespons
         Substring(m_responseText, startPos,
                   (endPos >= 0 ? endPos : responseLength) - startPos));
 
     MsgCompressWhitespace(responseLine);
     if (responseLine.LowerCaseEqualsLiteral("starttls")) {
       SetFlag(SMTP_EHLO_STARTTLS_ENABLED);
     } else if (responseLine.LowerCaseEqualsLiteral("dsn")) {
       SetFlag(SMTP_EHLO_DSN_ENABLED);
-    } else if (responseLine.LowerCaseEqualsLiteral("clientid")) {
-      SetFlag(SMTP_EHLO_CLIENTID_ENABLED);
-      // If we have "clientid" in the ehlo response, then TLS must be present.
-      if (m_prefSocketType == nsMsgSocketType::SSL) m_tlsEnabled = true;
     } else if (StringBeginsWith(responseLine, NS_LITERAL_CSTRING("AUTH"),
                                 nsCaseInsensitiveCStringComparator())) {
       SetFlag(SMTP_AUTH);
 
       if (responseLine.Find(NS_LITERAL_CSTRING("GSSAPI"),
                             /* ignoreCase = */ true) >= 0)
         SetFlag(SMTP_AUTH_GSSAPI_ENABLED);
 
@@ -951,48 +943,16 @@ nsresult nsSmtpProtocol::SendTLSResponse
 
   ClearFlag(SMTP_EHLO_STARTTLS_ENABLED);
   m_tlsInitiated = false;
   m_nextState = SMTP_AUTH_PROCESS_STATE;
 
   return rv;
 }
 
-nsresult nsSmtpProtocol::SendClientIDResponse() {
-  if (m_responseCode / 10 == 25) {
-    // ClientID success!
-    m_clientIDInitialized = true;
-    ClearFlag(SMTP_EHLO_CLIENTID_ENABLED);
-    m_nextState = SMTP_AUTH_PROCESS_STATE;
-    return NS_OK;
-  }
-  // ClientID failed
-  nsresult errorCode;
-  if (m_responseCode == 550) {
-    // 'You are not permitted to access this'
-    // 'Access Denied' + server response
-    errorCode = NS_ERROR_CLIENTID_PERMISSION;
-  } else {
-    if (MOZ_LOG_TEST(SMTPLogModule, mozilla::LogLevel::Error)) {
-      if (m_responseCode != 501 && m_responseCode != 503 &&
-          m_responseCode != 504 && m_responseCode / 100 != 4) {
-        // If not 501, 503, 504 or 4xx, log an error.
-        MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error,
-                ("SendClientIDResponse: Unexpected error occurred, server "
-                 "responded: %s\n",
-                 m_responseText.get()));
-      }
-    }
-    errorCode = NS_ERROR_CLIENTID;
-  }
-  nsExplainErrorDetails(m_runningURL, errorCode, m_responseText.get(), nullptr);
-  m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
-  return NS_ERROR_SMTP_AUTH_FAILURE;
-}
-
 void nsSmtpProtocol::InitPrefAuthMethods(int32_t authMethodPrefValue) {
   // for m_prefAuthMethods, using the same flags as server capabilities.
   switch (authMethodPrefValue) {
     case nsMsgAuthMethod::none:
       m_prefAuthMethods = SMTP_AUTH_NONE_ENABLED;
       break;
     // case nsMsgAuthMethod::old -- no such thing for SMTP
     case nsMsgAuthMethod::passwordCleartext:
@@ -1129,31 +1089,16 @@ nsresult nsSmtpProtocol::ProcessAuth() {
     } else if (m_prefSocketType == nsMsgSocketType::alwaysSTARTTLS) {
       m_nextState = SMTP_ERROR_DONE;
       m_urlErrorState = NS_ERROR_STARTTLS_FAILED_EHLO_STARTTLS;
       return NS_ERROR_STARTTLS_FAILED_EHLO_STARTTLS;
     }
   }
   // (wrong indentation until here)
 
-  if (!m_clientIDInitialized && m_tlsEnabled && !m_clientId.IsEmpty()) {
-    if (TestFlag(SMTP_EHLO_CLIENTID_ENABLED)) {
-      buffer = "CLIENTID TB-UUID ";
-      buffer += m_clientId;
-      buffer += CRLF;
-
-      status = SendData(buffer.get());
-
-      m_nextState = SMTP_RESPONSE;
-      m_nextStateAfterResponse = SMTP_CLIENTID_RESPONSE;
-      SetFlag(SMTP_PAUSE_FOR_READ);
-      return status;
-    }
-  }
-
   (void)ChooseAuthMethod();  // advance m_currentAuthMethod
 
   // We don't need to auth, per pref, or the server doesn't advertise AUTH,
   // so skip auth and try to send message.
   if (m_prefAuthMethods == SMTP_AUTH_NONE_ENABLED || !TestFlag(SMTP_AUTH)) {
     m_nextState = SMTP_SEND_HELO_RESPONSE;
     // fake to 250 because SendHeloResponse() tests for this
     m_responseCode = 250;
@@ -1988,22 +1933,16 @@ nsresult nsSmtpProtocol::ProcessProtocol
           status = SendHeloResponse(inputStream, length);
         break;
       case SMTP_SEND_EHLO_RESPONSE:
         if (inputStream == nullptr)
           SetFlag(SMTP_PAUSE_FOR_READ);
         else
           status = SendEhloResponse(inputStream, length);
         break;
-      case SMTP_CLIENTID_RESPONSE:
-        if (inputStream == nullptr)
-          SetFlag(SMTP_PAUSE_FOR_READ);
-        else
-          status = SendClientIDResponse();
-        break;
       case SMTP_AUTH_PROCESS_STATE:
         status = ProcessAuth();
         break;
 
       case SMTP_SEND_AUTH_GSSAPI_FIRST:
         status = AuthGSSAPIFirst();
         break;
 
--- a/mailnews/compose/src/nsSmtpProtocol.h
+++ b/mailnews/compose/src/nsSmtpProtocol.h
@@ -48,29 +48,27 @@ typedef enum _SmtpState {
   SMTP_AUTH_EXTERNAL_RESPONSE,            // 20
   SMTP_AUTH_PROCESS_STATE,                // 21
   SMTP_AUTH_CRAM_MD5_CHALLENGE_RESPONSE,  // 22
   SMTP_SEND_AUTH_GSSAPI_FIRST,            // 23
   SMTP_SEND_AUTH_GSSAPI_STEP,             // 24
   SMTP_SUSPENDED,                         // 25
   SMTP_AUTH_OAUTH2_STEP,                  // 26
   SMTP_AUTH_OAUTH2_RESPONSE,              // 27
-  SMTP_CLIENTID_RESPONSE,                 // 28
 } SmtpState;
 
 // State Flags (Note, I use the word state in terms of storing
 // state information about the connection (authentication, have we sent
 // commands, etc. I do not intend it to refer to protocol state)
 #define SMTP_PAUSE_FOR_READ 0x00000001 /* should we pause for the next read */
 #define SMTP_ESMTP_SERVER 0x00000002
 #define SMTP_EHLO_DSN_ENABLED 0x00000004
 #define SMTP_EHLO_STARTTLS_ENABLED 0x00000008
 #define SMTP_EHLO_SIZE_ENABLED 0x00000010
 #define SMTP_EHLO_8BIT_ENABLED 0x00000020
-#define SMTP_EHLO_CLIENTID_ENABLED 0x00000040
 
 // insecure mechanisms follow
 #define SMTP_AUTH_LOGIN_ENABLED 0x00000100
 #define SMTP_AUTH_PLAIN_ENABLED 0x00000200
 #define SMTP_AUTH_EXTERNAL_ENABLED 0x00000400
 // secure mechanisms follow
 #define SMTP_AUTH_GSSAPI_ENABLED 0x00000800
 #define SMTP_AUTH_DIGEST_MD5_ENABLED 0x00001000
@@ -136,29 +134,26 @@ class nsSmtpProtocol : public nsMsgAsync
   RefPtr<nsMsgLineStreamBuffer>
       m_lineStreamBuffer;  // used to efficiently extract lines from the
                            // incoming data stream
 
   nsTArray<nsCString> m_addresses;
   uint32_t m_addressesLeft;
   nsCString m_mailAddr;
   nsCString m_helloArgument;
-  nsCString m_clientId;
   int32_t m_sizelimit;
 
   // *** the following should move to the smtp server when we support
   // multiple smtp servers
   bool m_usernamePrompted;
   int32_t m_prefSocketType;
   bool m_tlsEnabled;
 
   bool m_tlsInitiated;
 
-  bool m_clientIDInitialized;
-
   bool m_sendDone;
 
   int32_t m_totalAmountRead;
   int64_t m_totalMessageSize;
 
   char *m_dataBuf;
   uint32_t m_dataBufSize;
 
@@ -198,17 +193,16 @@ class nsSmtpProtocol : public nsMsgAsync
   nsresult AuthLoginStep0();
   void AuthLoginStep0Response();
   nsresult AuthLoginStep1();
   nsresult AuthLoginStep2();
   nsresult AuthLoginResponse(nsIInputStream *stream, uint32_t length);
   nsresult AuthOAuth2Step1();
 
   nsresult SendTLSResponse();
-  nsresult SendClientIDResponse();
   nsresult SendMailResponse();
   nsresult SendRecipientResponse();
   nsresult SendDataResponse();
   void SendPostData();
   nsresult SendMessageResponse();
   nsresult ProcessAuth();
 
   ////////////////////////////////////////////////////////////////////////////////////////
--- a/mailnews/compose/src/nsSmtpServer.cpp
+++ b/mailnews/compose/src/nsSmtpServer.cpp
@@ -281,38 +281,16 @@ nsSmtpServer::SetUsername(const nsACStri
 
   // If the pref value is already empty, ClearUserPref will return
   // NS_ERROR_UNEXPECTED, so don't check the rv here.
   (void)mPrefBranch->ClearUserPref("username");
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSmtpServer::GetClientid(nsACString &aClientid) {
-  nsresult rv;
-  rv = mPrefBranch->GetCharPref("clientid", aClientid);
-  if (NS_FAILED(rv)) {
-    rv = mDefPrefBranch->GetCharPref("clientid", aClientid);
-    if (NS_FAILED(rv)) aClientid.Truncate();
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsSmtpServer::SetClientid(const nsACString &aClientid) {
-  if (!aClientid.IsEmpty())
-    return mPrefBranch->SetCharPref("clientid", aClientid);
-
-  // If the pref value is already empty, ClearUserPref will return
-  // NS_ERROR_UNEXPECTED, so don't check the rv here.
-  mPrefBranch->ClearUserPref("clientid");
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsSmtpServer::GetPassword(nsAString &aPassword) {
   if (m_password.IsEmpty() && !m_logonFailed) {
     // try to avoid prompting the user for another password. If the user has set
     // the appropriate pref, we'll use the password from an incoming server, if
     // the user has already logged onto that server.
 
     // if this is set, we'll only use this, and not the other prefs
     // user_pref("mail.smtpserver.smtp1.incomingAccount", "server1");
--- a/mailnews/imap/src/nsImapCore.h
+++ b/mailnews/imap/src/nsImapCore.h
@@ -138,17 +138,16 @@ const eIMAPCapabilityFlag kHasCompressDe
 const eIMAPCapabilityFlag kHasAuthExternalCapability =    0x20000000;  /* RFC 2222 SASL AUTH EXTERNAL */
 const eIMAPCapabilityFlag kHasMoveCapability =            0x40000000;  /* Proposed MOVE RFC */
 const eIMAPCapabilityFlag kHasHighestModSeqCapability =   0x80000000;  /* Subset of RFC 3551 */
 // above are 32bit; below start the uint64_t bits 33-64
 const eIMAPCapabilityFlag kHasListExtendedCapability =    0x100000000LL;  /* RFC 5258 */
 const eIMAPCapabilityFlag kHasSpecialUseCapability =      0x200000000LL;  /* RFC 6154: Sent, Draft etc. folders */
 const eIMAPCapabilityFlag kGmailImapCapability =          0x400000000LL;  /* X-GM-EXT-1 capability extension for gmail */
 const eIMAPCapabilityFlag kHasXOAuth2Capability =         0x800000000LL;  /* AUTH XOAUTH2 extension */
-const eIMAPCapabilityFlag kHasClientIDCapability =        0x1000000000LL; /* ClientID capability */
 
 
 // this used to be part of the connection object class - maybe we should move it into
 // something similar
 typedef enum {
     kEveryThingRFC822,
     kEveryThingRFC822Peek,
     kHeadersRFC822andUid,
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -871,18 +871,16 @@ nsresult nsImapProtocol::SetupWithUrl(ns
                               &preferPlainText);
       // If the pref has changed since the last time we ran a url,
       // clear the shell cache for this host.
       if (preferPlainText != m_preferPlainText) {
         m_hostSessionList->ClearShellCacheForHost(GetImapServerKey());
         m_preferPlainText = preferPlainText;
       }
     }
-    // Retrieve the clientid so that we can use it later.
-    server->GetClientid(m_clientId);
 
     bool proxyCallback = false;
     if (m_runningUrl && !m_transport /* and we don't have a transport yet */) {
       if (m_mockChannel) {
         rv = MsgExamineForProxyAsync(m_mockChannel, this,
                                      getter_AddRefs(m_proxyRequest));
         if (NS_FAILED(rv)) {
           rv = SetupWithUrlCallback(nullptr);
@@ -5564,30 +5562,16 @@ nsresult nsImapProtocol::SendDataParseIM
       break;
     }
     isResend = true;
   }
 
   return rv;
 }
 
-nsresult nsImapProtocol::ClientID() {
-  IncrementCommandTagNumber();
-  nsCString command(GetServerCommandTag());
-  command += " CLIENTID TB-UUID ";
-  command += m_clientId;
-  command += CRLF;
-  nsresult rv = SendDataParseIMAPandCheckForNewMail(command.get(), nullptr);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (!GetServerStateParser().LastCommandSuccessful()) {
-    return NS_ERROR_FAILURE;
-  }
-  return NS_OK;
-}
-
 nsresult nsImapProtocol::AuthLogin(const char *userName,
                                    const nsString &aPassword,
                                    eIMAPCapabilityFlag flag) {
   ProgressEventFunctionUsingName("imapStatusSendingAuthLogin");
   IncrementCommandTagNumber();
 
   char *currentCommand = nullptr;
   nsresult rv;
@@ -8140,34 +8124,16 @@ bool nsImapProtocol::TryToLogon() {
         MOZ_LOG(IMAP, LogLevel::Error,
                 ("huch? there are auth methods, and we reset failed ones, but "
                  "ChooseAuthMethod still fails."));
         return false;
       }
     }
   }
 
-  // Before running the ClientID command we check for clientid
-  // support by checking the server capability flags for the
-  // flag kHasClientIDCapability.
-  // We also check that the m_clientId string is not empty,
-  // and we also ensure tls/ssl is running by checking if
-  // m_connectionType contains "starttls" or "ssl".
-  if ((GetServerStateParser().GetCapabilityFlag() & kHasClientIDCapability) &&
-      !m_clientId.IsEmpty() &&
-      (m_connectionType.EqualsLiteral("starttls") ||
-       m_connectionType.EqualsLiteral("ssl"))) {
-    rv = ClientID();
-    if (NS_FAILED(rv)) {
-      MOZ_LOG(IMAP, LogLevel::Error,
-              ("TryToLogon: Could not issue CLIENTID command"));
-      skipLoop = true;
-    }
-  }
-
   // Get username, either the stored one or from user
   rv = m_imapServerSink->GetLoginUsername(userName);
   if (NS_FAILED(rv) || userName.IsEmpty()) {
     // The user hit "Cancel" on the dialog box
     skipLoop = true;
   }
 
   // clang-format off
--- a/mailnews/imap/src/nsImapProtocol.h
+++ b/mailnews/imap/src/nsImapProtocol.h
@@ -532,17 +532,16 @@ class nsImapProtocol : public nsIImapPro
   void Capability();  // query host for capabilities.
   void ID();          // send RFC 2971 app info to server
   void EnableCondStore();
   void StartCompressDeflate();
   nsresult BeginCompressing();
   void Language();  // set the language on the server if it supports it
   void Namespace();
   void InsecureLogin(const char *userName, const nsCString &password);
-  nsresult ClientID();
   nsresult AuthLogin(const char *userName, const nsString &password,
                      eIMAPCapabilityFlag flag);
   nsresult SendDataParseIMAPandCheckForNewMail(const char *data,
                                                const char *command);
   void ProcessAuthenticatedStateURL();
   void ProcessAfterAuthenticated();
   void ProcessSelectedStateURL();
   bool TryToLogon();
@@ -679,18 +678,16 @@ class nsImapProtocol : public nsIImapPro
   nsDataHashtable<nsCStringHashKey, int32_t> m_specialXListMailboxes;
 
   nsCOMPtr<nsIImapHostSessionList> m_hostSessionList;
 
   bool m_fromHeaderSeen;
 
   nsString mAcceptLanguages;
 
-  nsCString m_clientId;
-
   // progress stuff
   void SetProgressString(uint32_t aStringIndex);
 
   nsCString m_progressStringName;
   uint32_t m_stringIndex;
   int32_t m_progressCurrentNumber[IMAP_NUMBER_OF_PROGRESS_STRINGS];
   int32_t m_progressExpectedNumber;
   nsCString m_lastProgressStringName;
--- a/mailnews/imap/src/nsImapServerResponseParser.cpp
+++ b/mailnews/imap/src/nsImapServerResponseParser.cpp
@@ -2019,18 +2019,16 @@ void nsImapServerResponseParser::capabil
       else if (token.Equals("COMPRESS=DEFLATE",
                             nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kHasCompressDeflateCapability;
       else if (token.Equals("MOVE", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kHasMoveCapability;
       else if (token.Equals("HIGHESTMODSEQ",
                             nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kHasHighestModSeqCapability;
-      else if (token.Equals("CLIENTID", nsCaseInsensitiveCStringComparator()))
-        fCapabilityFlag |= kHasClientIDCapability;
     }
   } while (fNextToken && endToken < 0 && !fAtEndOfLine && ContinueParse());
 
   nsImapProtocol *navCon = &fServerConnection;
   NS_ASSERTION(navCon,
                "null imap protocol connection while parsing capability "
                "response");  // we should always have this
   if (navCon) navCon->CommitCapability();
--- a/mailnews/mailnews.js
+++ b/mailnews/mailnews.js
@@ -450,19 +450,16 @@ pref("mail.collect_email_address_incomin
 pref("mail.collect_email_address_newsgroup", false);
 #endif
 pref("mail.collect_email_address_outgoing", true);
 // by default, use the Collected Addressbook for collection
 pref("mail.collect_addressbook", "moz-abmdbdirectory://history.mab");
 
 pref("mail.default_sendlater_uri", "mailbox://nobody@Local%20Folders/Unsent%20Messages");
 
-pref("mail.server.default.clientid", "");
-pref("mail.smtpserver.default.clientid", "");
-
 pref("mail.smtpservers", "");
 pref("mail.accountmanager.accounts", "");
 
 // Last used account key value
 pref("mail.account.lastKey", 0);
 
 pref("mail.server.default.port", -1);
 pref("mail.server.default.offline_support_level", -1);