# HG changeset patch # User Ping Chen # Date 1643882972 -7200 # Thu Feb 03 12:09:32 2022 +0200 # Node ID 90ecd49f236cdf41dae1b3dec342b082d578a630 # Parent 25193fde9502229b42b98183fb2fe8ea9c121e78 Bug 1752397 - Drop initial empty AUTH command in nsPop3Protocol.cpp. r=mkmelin Depends on D137597. Differential Revision: https://phabricator.services.mozilla.com/D137605 diff --git a/mailnews/local/src/nsPop3Protocol.cpp b/mailnews/local/src/nsPop3Protocol.cpp --- a/mailnews/local/src/nsPop3Protocol.cpp +++ b/mailnews/local/src/nsPop3Protocol.cpp @@ -1621,17 +1621,17 @@ int32_t nsPop3Protocol::SendTLSResponse( nsCOMPtr sslControl = do_QueryInterface(secInfo, &rv); if (NS_SUCCEEDED(rv) && sslControl) rv = sslControl->StartTLS(); } if (NS_SUCCEEDED(rv)) { - m_pop3ConData->next_state = POP3_SEND_AUTH; + m_pop3ConData->next_state = POP3_SEND_CAPA; m_tlsEnabled = true; // certain capabilities like POP3_HAS_AUTH_APOP should be // preserved across the connections. uint32_t preservedCapFlags = m_pop3ConData->capability_flags & POP3_HAS_AUTH_APOP; m_pop3ConData->capability_flags = // resetting the flags POP3_AUTH_MECH_UNDEFINED | POP3_HAS_AUTH_USER | // should be always there @@ -3902,23 +3902,18 @@ nsresult nsPop3Protocol::ProcessProtocol } m_pop3ConData->pause_for_read = false; // we are already connected so just go on and send the username if (m_prefAuthMethods == POP3_HAS_AUTH_USER) { m_currentAuthMethod = POP3_HAS_AUTH_USER; m_pop3ConData->next_state = POP3_SEND_USERNAME; - } - else - { - if (TestCapFlag(POP3_AUTH_MECH_UNDEFINED)) - m_pop3ConData->next_state = POP3_SEND_AUTH; - else - m_pop3ConData->next_state = POP3_SEND_CAPA; + } else { + m_pop3ConData->next_state = POP3_SEND_CAPA; } break; } case POP3_START_CONNECT: { m_pop3ConData->next_state = POP3_FINISH_CONNECT; @@ -3942,23 +3937,18 @@ nsresult nsPop3Protocol::ProcessProtocol status = WaitForStartOfConnectionResponse(aInputStream, aLength); if(status) { if (m_prefAuthMethods == POP3_HAS_AUTH_USER) { m_currentAuthMethod = POP3_HAS_AUTH_USER; m_pop3ConData->next_state = POP3_SEND_USERNAME; - } - else - { - if (TestCapFlag(POP3_AUTH_MECH_UNDEFINED)) - m_pop3ConData->next_state = POP3_SEND_AUTH; - else - m_pop3ConData->next_state = POP3_SEND_CAPA; + } else { + m_pop3ConData->next_state = POP3_SEND_CAPA; } } break; } case POP3_SEND_AUTH: status = SendAuth(); diff --git a/mailnews/local/test/unit/head_maillocal.js b/mailnews/local/test/unit/head_maillocal.js --- a/mailnews/local/test/unit/head_maillocal.js +++ b/mailnews/local/test/unit/head_maillocal.js @@ -110,16 +110,21 @@ function do_check_transaction(real, expe real = real[real.length - 1]; // real.them may have an extra QUIT on the end, where the stream is only // closed after we have a chance to process it and not them. We therefore // excise this from the list if (real.them[real.them.length-1] == "QUIT") real.them.pop(); + if (expected[0] == "AUTH") { + // We don't send inital AUTH command now. + expected = expected.slice(1); + } + Assert.equal(real.them.join(","), expected.join(",")); dump("Passed test " + test + "\n"); } function create_temporary_directory() { let directory = Services.dirsvc.get("TmpD", Ci.nsIFile); directory.append("mailFolder"); directory.createUnique(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0700", 8));