smtp: don't send QUIT to connections that failed the STARTTLS handshake (#679)

This commit is contained in:
Paolo Barbolini
2021-10-06 19:25:50 +02:00
committed by GitHub
parent af157c5f26
commit addf8754dd
2 changed files with 2 additions and 5 deletions

View File

@@ -161,10 +161,7 @@ impl AsyncSmtpConnection {
) -> Result<(), Error> {
if self.server_info.supports_feature(Extension::StartTls) {
try_smtp!(self.command(Starttls).await, self);
try_smtp!(
self.stream.get_mut().upgrade_tls(tls_parameters).await,
self
);
self.stream.get_mut().upgrade_tls(tls_parameters).await?;
#[cfg(feature = "tracing")]
tracing::debug!("connection encrypted");
// Send EHLO again

View File

@@ -145,7 +145,7 @@ impl SmtpConnection {
#[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
{
try_smtp!(self.command(Starttls), self);
try_smtp!(self.stream.get_mut().upgrade_tls(tls_parameters), self);
self.stream.get_mut().upgrade_tls(tls_parameters)?;
#[cfg(feature = "tracing")]
tracing::debug!("connection encrypted");
// Send EHLO again