Bug 1079280 - Don't transmit email when imap append response is bad. r=Irving,GeneSmith DONTBUILD
authorThomas Cataldo <thomas.cataldo@blue-mind.net>
Thu, 09 Aug 2018 21:47:09 -0400
changeset 24464 0699247922815a504dc48543ea546e3530644b4e
parent 24463 c46bbc970cb95e9026508c65834a4f7f6f65104d
child 24465 32da318e9476ff259c1a259d0640959d3cf7e7f5
push id14720
push usermozilla@jorgk.com
push dateFri, 10 Aug 2018 05:49:23 +0000
treeherdercomm-central@069924792281 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIrving, GeneSmith
bugs1079280
Bug 1079280 - Don't transmit email when imap append response is bad. r=Irving,GeneSmith DONTBUILD This only applies to non-literal+ appends. Bad response typically occurs when {size} parameter of append command is larger than server can accept. This prevents TB from sending megabytes of data to a server that has already rejected it.
mailnews/imap/src/nsImapProtocol.cpp
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -6189,17 +6189,21 @@ void nsImapProtocol::UploadMessageFromFi
       command.AppendLiteral("+}" CRLF);
     else
       command.AppendLiteral("}" CRLF);
 
     rv = SendData(command.get());
     if (NS_FAILED(rv)) goto done;
 
     if (!useLiteralPlus)
+    {
       ParseIMAPandCheckForNewMail();
+      if (!GetServerStateParser().LastCommandSuccessful())
+        goto done;
+    }
 
     totalSize = fileSize;
     readCount = 0;
     while(NS_SUCCEEDED(rv) && !eof && totalSize > 0)
     {
       rv = fileInputStream->Read(dataBuffer, COPY_BUFFER_SIZE, &readCount);
       if (NS_SUCCEEDED(rv) && !readCount)
         rv = NS_ERROR_FAILURE;